Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET WebHosting
Hello every one ,
 
I am a software developer working on ASP.Net C# . I am facing problem in creating ASP session when my asp.net web application is deployed in ISS.
 
Here in detail
 
If i run my application through VS software the session id carrying data from Login.aspx to homePage.aspx and Logout is fine means session destroy is fine
 
The same thing when I deploy the Application to IIS or webhosted when i login the session is not carrying the data . If i retrive data from session it shows "Object reference is not set to be an instance of object ". Hope session is not working .
 
I am facing this problem in Crome and Opera Browser. But it is working good in Internet explorer and Firefox.
 
First I taught Session its self not working but later on i found that in some browser it is working and in some it is not ....
 
here is the code how i implemented
Session["UserID"]=TextBox1.Text;
to retrive Data
 
string UserID=Session["UserID"].Tostring();
 
so can anybody give me any suggestion or hint for this problem
 
Tanks in Advance
Posted 5-Jan-13 3:25am
arunrv2.5K
Edited 5-Jan-13 4:36am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
if you are trying to make a login page, try adding the below into your web.config
 
<authentication mode="Forms">
     <forms loginUrl="login.aspx" protection="All" timeout="30" name="AppNameCookie" slidingExpiration="true" cookieless="UseCookies" enableCrossAppRedirects="false"/>
   </authentication>
   <authorization>
     <deny users="?"/>
     <allow users="*"/>
   </authorization
 
and works fine in Chrome for me
 
the rest of the coding is similar as you have mentioned above.
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100