How can I remove the ASP.NET Session ID from my UR

2019-01-20 10:55发布

问题:

How can I remove the identifier from my URL?

In this example URL I need just index.aspx, how do I remove (S(w0uz0245gtucb3am0k5w5g55))?

http://www.example.com/(S(w0uz0245gtucb3am0k5w5g55))/index.aspx

回答1:

Your webserver is rewriting your urls to include the session state because you have configured your site to not use cookies.

If you look at your site's web.config file, you will probably find this line:

<sessionState cookieless="true" />

If you change the value to "false" if will solve your problem (or just remove the line entirely - the default value is false)

More information about this configuration can be found here and here.



回答2:

You could wrap your entire application in an iFrame. Nobody would see the long URL.