Daniel Bişar
Daniel Bişar

Reputation: 2773

HowTo use Session in ASP.NET with custom session key parameter

Is it possible to use ASP.NETs session state with URL like

http://myserver/somesite?sessionKey=thekey

The problem is, that I have to write a site for a client software which authenticates a user by a request like

http://myserver/somesite?user=xyz&passwd=xyz

The client expects than to get a session key as result if the authentication was successful. This session key will then be used as variable in the query as shown above. The client does not support cookies.

How can I implement this behavior by using ASP.NET MVC 4?

P.S.: I know it is absolutly not the way to go but I am not in position to change the client.

Upvotes: 3

Views: 1399

Answers (1)

Radim Köhler
Radim Köhler

Reputation: 123861

If I do understand you correctly, you could just try it, right?

(We already met it, and it was a pain for searching engines)

<sessionState mode="InProc" timeout="5" cookieless="true" />

And I can say it is working The url generated instead of

"http://server/Product/en-GB/MyEntity"

is now:

"http://server/Product/(S(rxavnpuw05o3fmy3tjnuystr))/en-GB/MyEntity"

Upvotes: 1

Related Questions