By implementing ihttphandler, you can easily access ASP. NET ApplicationProgramAnd implement some underlying interactions.
Today, it happened that the session cannot be accessed in the class implementing ihttphanlder. The returned value of httpcontext. Current. Session is null,
I checked it online. It turns out to be:
If your handler accesses the session status value, it must implement the irequiressessionstate interface (the flag interface that does not contain any methods ).
Import using system. Web. sessionstate;
Sure enough, you only need to add an irequiressessionstate flag interface to the custom class and do not need to implement any methods.
At the same time, there is another interface: ireadonlysessionstate interface, which is used to indicate the HTTP processing program and has read-only permissions on the session. It is also a null interface,
No implementation is required.