Click here to Skip to main content
15,910,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
var ip = context.Request.Headers["Host"];

           HttpContext.Current.Session["ip"] = ip;



I am getting null value in session.

plz help me
Posted
Comments
Mahesh Bailwal 16-May-13 7:57am    
What type of application are you working on Windows or Web(ASP.Net)?
Ranjith Kumar 16-May-13 7:58am    
Web

1 solution

Did you enable session? In web.config , you could configure session state.

HTML
<configuration>
   <system.web>
      <sessionstate mode="InProc" cookieless="true" timeout="20" />
      
   </system.web>
</configuration>


Check this link. http://msdn.microsoft.com/en-us/library/h6bb9cz9%28v=vs.71%29.aspx[^]
 
Share this answer
 
Comments
Ranjith Kumar 16-May-13 8:29am    
var ip = context.Request.Headers["Host"];
HttpContext.Current.Session["ip"] = ip;

still null in session
Mahesh Bailwal 17-May-13 3:38am    
are you making call to httpHandler(.ashx) or .aspx page? Can you provide the request URL

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