How to use session in .ashx file
Andrew Hancock - VMware vExpert. See if this solution works for you by signing up for a 7 day free trial. What do I get with a subscription? With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Who are the certified experts? How quickly will I get my solution? We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.
This will save you the trouble of building a messy work around. Your email address will not be published. This site uses Akismet to reduce spam. Learn how your comment data is processed. NET C Sharp session.
I added using using System. SessionState; at the top of my handler but that didn't seem to do anything useful. The Session variable HttpContext. When I get to the aspx file and call HttpContext. I've used this as guidance How to access Session in. The when the request in the handler is finished processing, the next code in the ASPX file is this:. But HttpContext. ToString is now blank again. Basically it looks like the handler and the web form aren't communicating or the session isn't being shared.
I've checked to make sure the namespace is the same. Anything else I should check? Make sure the handler inherits from System. IRequiresSessionState , just like in the link you provided. You shouldn't need to have the HttpContext. Current part, if you import the namespace. The issue was a rookie mistake in that I was getting a response back from the form but wasn't looking in the right place.
It turned out it was in bytes and the session id from the ASHX file was there. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years ago. Active 2 years, 3 months ago. Viewed 9k times. I'm trying to set a session variable in an ASHX file.
0コメント