By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,958 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,958 IT Pros & Developers. It's quick & easy.

IIS7 - New session id with every request

P: 7
Hi,

I have a website running in IIS7 and it seems to be creating a new session for every request I make. The values I store in Session are lost with every request.

This is the forms bit in my web.config:

<authentication mode="Forms">
<forms name=".ReMaCRM" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx" cookieless="AutoDetect" domain="" timeout="10" protection="All" />
</authentication>


And session state is configured in IIS as
In Process
Use Cookies
Time out = 10 minutes
Use hosting identity for impersonation


I have run a trace for both IE7 and Firefox 3, and the results are a bit different, hopefully this will highlight some clues. I have run a quick test, I have a page that shows a list of products
in a gridview, then the user would select a couple, hit a button and see those products selected in a details page. The products are stored in session so the details page knows which ones were selected.
The obvious things I notice are:

- In IE, the session id changes with each request whicle in Firefox stays the same (this is good) hence the IsNew value for IE is true while Firefox keeps it false (same session).

- In IE the request cookies remain empty, while in Firefox I can see the cookie I specified in web.config (MyCookie)

- However Firefox has empty Response cookies, while IE stores some values. This however is not stopping Firefox from workimng fine.

-PRODUCTLIST is a session variable that remains empty in IE while Firefox shows the products selected

- IE is adding a lot of crap to the url while Firefox keeps it clean.



Any ideas highly appreciated, this is getting desperate. EnableSessionState is true (default). Everything works fine in Windows Server 2003 and IIS6.


Thanks


IE7, PRODUCTS LIST
************************************************** *************************
Request Details
Session Id: 5ndmre45eef30w5513xwla55

PRODUCTLIST=---
COOKIELESS=False
ISNEW=True
MODE=InProc
SESSIONID=5ndmre45eef30w5513xwla55
TIMEOUT=10
COOKIEMODE=UseCookies

Request Cookies Collection
<Empty>

Response Cookies Collection
ASP.NET_SessionId 5ndmre45eef30w5513xwla55 42
CurrLanguage 6

Headers Collection
Connection Keep-Alive
Referer http://mywebsite/(X(1)F(-ewRO3icZtByyRBJbZuhOnOj_5Se-UBrWkMnJzOElOK71P6hfWDg60I7jFOlafyb9-khfm76UqZNxNttnb9DpN-m-84_3-r3TlSJgEFxiPw1))/Default.aspx
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; InfoPath.2)
UA-CPU x86
AspFilterSessionId X(1)F(-ewRO3icZtByyRBJbZuhOnOj_5Se-UBrWkMnJzOElOK71P6hfWDg60I7jFOlafyb9-khfm76UqZNxNttnb9DpN-m-84_3-r3TlSJgEFxiPw1)

Response Headers Collection
X-AspNet-Version 2.0.50727
Set-Cookie ASP.NET_SessionId=5ndmre45eef30w5513xwla55; path=/; HttpOnly
Set-Cookie CurrLanguage=6; expires=Tue, 30-Jun-2009 15:33:09 GMT; path=/
Cache-Control private
Content-Type text/html

IE, SHOWS 2 PRODUCTS SELECTED FORM LIST
************************************************** *************************

Request Details
Session Id: si20jp45n3bvc0zd33vgwpub

PRODUCTLIST=---
COOKIELESS=False
ISNEW=True
MODE=InProc
SESSIONID=si20jp45n3bvc0zd33vgwpub
TIMEOUT=10
COOKIEMODE=UseCookies

Request Cookies Collection
<Empty>

Response Cookies Collection
ASP.NET_SessionId si20jp45n3bvc0zd33vgwpub
CurrLanguage 6

Headers Collection
Cache-Control no-cache
Connection Keep-Alive
Referer http://mywebsite/(X(1)F(-ewRO3icZtByyRBJbZuhOnOj_5Se-UBrWkMnJzOElOK71P6hfWDg60I7jFOlafyb9-khfm76UqZNxNttnb9DpN-m-84_3-r3TlSJgEFxiPw1))/Products.aspx
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; InfoPath.2)
UA-CPU x86
AspFilterSessionId X(1)F(-ewRO3icZtByyRBJbZuhOnOj_5Se-UBrWkMnJzOElOK71P6hfWDg60I7jFOlafyb9-khfm76UqZNxNttnb9DpN-m-84_3-r3TlSJgEFxiPw1)

Response Headers Collection
X-AspNet-Version 2.0.50727
Set-Cookie ASP.NET_SessionId=si20jp45n3bvc0zd33vgwpub; path=/; HttpOnly
Set-Cookie CurrLanguage=6; expires=Tue, 30-Jun-2009 15:37:03 GMT; path=/
Cache-Control private
Content-Type text/html


************************************************** *************************
************************************************** *************************
************************************************** *************************


Firefox, PRODUCTS LIST
************************************************** *************************

Request Details
Session Id: 5isfv345keniqw32m1py3t3z

PRODUCTLIST=---
COOKIELESS=False
ISNEW=False
MODE=InProc
SESSIONID=5isfv345keniqw32m1py3t3z
TIMEOUT=10
COOKIEMODE=UseCookies


Request Cookies Collection
CurrLanguage 6
ASP.NET_SessionId 5isfv345keniqw32m1py3t3z
MyCookie CFFBB3756BC404FD9771FA01D15856445B6843DAC2476551D4 9850F34648A2D99860BB5FC0259E0848F23EDBB64F3FAA91EA 8E3ABB0A63B1E9F10CF5B27A3A232BEFA8EDEE0D16B0289B27 46F52C4DF0 169

Response Cookies Collection
<Empty>

Headers Collection
Connection keep-alive
Keep-Alive 300
Cookie CurrLanguage=6; ASP.NET_SessionId=5isfv345keniqw32m1py3t3z; .MyCookie=CFFBB3756BC404FD9771FA01D15856445B6843DA C2476551D49850F34648A2D99860BB5FC0259E0848F23EDBB6 4F3FAA91EA8E3ABB0A63B1E9F10CF5B27A3A232BEFA8EDEE0D 16B0289B2746F52C4DF0
Referer http://mywebsite/ProductDetails.aspx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0

Response Headers Collection
X-AspNet-Version 2.0.50727
Cache-Control private
Content-Type text/htm


Firefox, SHOWS 2 PRODUCTS SELECTED FORM LIST
************************************************** *************************
Request Details
Session Id: 5isfv345keniqw32m1py3t3z

PRODUCTLIST=43808,43794
COOKIELESS=False
ISNEW=False
MODE=InProc
SESSIONID=5isfv345keniqw32m1py3t3z
TIMEOUT=10
COOKIEMODE=UseCookies

Request Cookies Collection
CurrLanguage 6
ASP.NET_SessionId 5isfv345keniqw32m1py3t3z
.MyCookie CFFBB3756BC404FD9771FA01D15856445B6843DAC2476551D4 9850F34648A2D99860BB5FC0259E0848F23EDBB64F3FAA91EA 8E3ABB0A63B1E9F10CF5B27A3A232BEFA8EDEE0D16B0289B27 46F52C4DF0 169

Response Cookies Collection
<Empty>

Headers Collection
Connection keep-alive
Keep-Alive 300
Cookie CurrLanguage=6; ASP.NET_SessionId=5isfv345keniqw32m1py3t3z; .ReMaCRM=CFFBB3756BC404FD9771FA01D15856445B6843DAC 2476551D49850F34648A2D99860BB5FC0259E0848F23EDBB64 F3FAA91EA8E3ABB0A63B1E9F10CF5B27A3A232BEFA8EDEE0D1 6B0289B2746F52C4DF0
Referer http://mywebsite/Products.aspx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0

Response Headers Collection
X-AspNet-Version 2.0.50727
Cache-Control private
Content-Type text/html
Jul 1 '08 #1
Share this Question
Share on Google+
3 Replies


Plater
Expert 5K+
P: 7,872
IE is blocking your session cookie
Jul 1 '08 #2

P: 7
IE is blocking your session cookie
Hi,
yeah I believe so but why? I have reduced the security levels to a minimum and the browser has no problems accepting cookies from other sites. In fact it accepts cookies from my same website when hosted in a Windows Server 2003 with II6.
Thanks
Jul 1 '08 #3

P: 7
Hi,

I have resolved the problem. The reason why it wasn't working is, deep breath, because my website's url contained an underscore character (ie http://my_website).

I have changed the name and now it all works fine. I can not believe how STUPID this is. Thanks IE for another nice "feature". And well done Safari for copying such functionality. Firefox and Opera, you still remain favourites.
Jul 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.