Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to use session in ashx file so that I can use it in aspx?
Posted

Yes you can access the session in your ashx file. For that you need to implement IRequiresSessionState interface in your handler class. In ashx file you can access session with HttpContext Object from ProcessRequest method.


--Amit
 
Share this answer
 
Comments
Mohammed Hameed 22-Jun-13 1:23am    
+5 for your answer :)
_Amy 22-Jun-13 1:48am    
Thanks Hameed. :)
sunpop 22-Jun-13 12:12pm    
Thanks Amit. I have created a session variable in ProcessRequest method. Now how to get that session value in .aspx page?
sunpop 12-Jul-13 2:34am    
In aspx file
I call the session by
string a = Session["sessionName"].toString();

For this I got only null value. But when I included the following code in Web.Config, it works well.


<configuration>
<system.web>
<sessionstate mode="InProc" cookieless="true">
In PrcessRequest method I created a session like
context.Session["sessionName"]=stringValue;


In aspx file
I call the session ust by
string a = Session["sessionName"].toString();

For this I got only null value. But when I included the following code in Web.Config, it works well.

XML
<configuration>
   <system.web>
<sessionState mode="InProc"  cookieless="true" />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900