How can I trigger Session Start (Global.asax) Event for a WebHandler Request?

后端 未结 2 1440
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 16:41

I have a Webhandler which generates an image on request in my asp.net Project. But if the user directly access the resource, it won\'t trigger the session start Event in the Gl

2条回答
  •  情深已故
    2021-02-20 17:28

    The Session_Start event is trigerred whenever some server side handler attempts to either read or write to the session. You might try decorating your handler with the IRequiresSessionState marker interface:

    public class MyHandler: IHttpHandler, IRequiresSessionState
    {
        ...
    }
    

提交回复
热议问题