Aung Kaung Hein
Aung Kaung Hein

Reputation: 1576

Random number in URL of ASP .NET web application

This is my first time having this problem in my ASP .NET C# application. For the past one year during development, it was working fine. But suddenly I noticed that random numbers are generated in the URL. I am very sure that I didn't change any code. How come it become like this?

172.168.1.20/(S(y40zo0h0pehggfcby4zlrxwt))/LoginPage.aspx

It should be:

172.168.1.20/LoginPage.aspx

(S(y40zo0h0pehggfcby4zlrxwt)) is randomly generated every time when I debug the application. Anybody has idea what happened? Any help will be much appreciated.

Upvotes: 1

Views: 898

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039120

Anybody has idea what happened?

The ASP.NET application doesn't recognize your User-Agent as supporting cookies and encoding the session identifier in the url instead. You could explicitly force the session to use cookies in your web.config by setting the cookieless property to UseCookies:

<sessionState cookieless="UseCookies" ... />

You can read more about cookieless sessions in ASP.NET in this article: http://msdn.microsoft.com/en-us/library/aa479315.aspx

The same applies to Forms Authentication (not to be confused with ASP.NET Session):

<forms cookieless="UseCookies" ... />

Upvotes: 5

Related Questions