Click here to Skip to main content
13,055,754 members (51,898 online)
Rate this:
Please Sign up or sign in to vote.
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 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

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 2:25am
Updated 5-Jan-13 3:36am

1 solution

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

Solution 1


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"/>
     <deny users="?"/>
     <allow users="*"/>

and works fine in Chrome for me

the rest of the coding is similar as you have mentioned above.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2017
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