(turn) ASHX use session

Source: Internet
Author: User

This article was reproduced from: http://www.cnblogs.com/TivonStone/archive/2012/04/06/2434796.html

Recently do a project, call the Ashx file, where the ashx file is useful to the session, but always can not get the session, after debugging, the cause of the error:

Broadly as follows

Context. session["requeststate"] = state;

Review MSDN get ashx file to use the session, you must implement the session interface, as follows

 Public classQqcallbackhandle:ihttphandler,system.web.sessionstate.irequiressessionstate { Public voidProcessRequest (HttpContext context) {varQqcontext =NewQConnectSDK.Context.QzoneContext (); stringState = Guid.NewGuid (). ToString (). Replace ("-",""); stringScope =""; varAuthenticationurl =Qqcontext.getauthorizationurl (State, scope); //request token, request token secret need to be saved.//In the demo demo, it is saved directly in the global variable. The real situation needs to be handled by the website itselfContext. session["RequestState"] =State ; Context.    Response.Redirect (Authenticationurl); }       Public BOOLisreusable {Get {            return false; }    } }

(turn) ASHX use session

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.