Search code examples
asp.netsessionpostashx

ashx handler post issue


I'm getting some confusing results around myCustom.ashx handler.

If i visit the handler via the browser:

Token.Instance.User.UserId = 162 // which is correct

If i post to the handler:

Token.Instance.User.UserId = 163 // a new user is generated.

It's seems like when i post it creates a new session.

extra info:

public class myCustom: IHttpHandler, IReadOnlySessionState


<sessionState mode="InProc" timeout="30" cookieName="xxx"/>

Solution

  • Are you using a tool to do the post? Does it have a different UserAgent string? That could be why you're getting a different session/userId than in the browser.