Click here to Skip to main content
15,881,861 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
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
C#
Session["UserID"]=TextBox1.Text;

to retrive Data

C#
string UserID=Session["UserID"].Tostring();


so can anybody give me any suggestion or hint for this problem

Tanks in Advance
Posted
Updated 5-Jan-13 3:36am
v2

1 solution

Hi,

if you are trying to make a login page, try adding the below into your web.config

XML
<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.
 
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