.aspx sessions being called in .ashx handlerhttp://forums.asp.net/t/1574816.aspx/1?+aspx+sessions+being+called+in+ashx+handlerThu, 22 Jul 2010 22:29:40 -040015748163955880http://forums.asp.net/p/1574816/3955880.aspx/1?+aspx+sessions+being+called+in+ashx+handler.aspx sessions being called in .ashx handler <p>I have an Handler.ashx file and on .aspx page load it calles the .ashx file for image reading.&nbsp; I am attempting to pass a session from the .aspx file to the .ashx file in order to make my query of grabing the image&nbsp;secure.&nbsp; The problem is that everytime I call a session:&nbsp;HttpContext.Current.Session[&quot;ID&quot;], the value is returning null or&nbsp;errors saying&nbsp;the o so commong &quot;Object reference not set to an instance of the object&quot;.&nbsp; I have tried&nbsp;a couple&nbsp;ways of grabing the session:</p> <p>1.)&nbsp; context.Session[&quot;ID&quot;]</p> <p>2.)&nbsp; HttpContext.Session[&quot;ID&quot;]</p> <p>3.)&nbsp; HttpContext.Current.Cache[&quot;ID&quot;]</p> <p>none of them are giving me the ID session set in the .aspx page.&nbsp; should i be using Server.Transfer instead? is there a way to grab a session variable set in a .aspx page and called in a .ashx page?</p> <p>&nbsp;</p> <p>Any suggestions would be appreciated,</p> <p>- NUStudent</p> 2010-07-02T14:51:57-04:003956024http://forums.asp.net/p/1574816/3956024.aspx/1?Re+aspx+sessions+being+called+in+ashx+handlerRe: .aspx sessions being called in .ashx handler <p>Does&nbsp;your ashx &nbsp;imlpement the IReadOnlySessionState interface?</p> <p>Refer: <a href="http://www.hanselman.com/blog/GettingSessionStateInHttpHandlersASHXFiles.aspx"> http://www.hanselman.com/blog/GettingSessionStateInHttpHandlersASHXFiles.aspx</a></p> 2010-07-02T16:42:50-04:003987532http://forums.asp.net/p/1574816/3987532.aspx/1?Re+aspx+sessions+being+called+in+ashx+handlerRe: .aspx sessions being called in .ashx handler <p>this doesnt work for me!&nbsp; anyone else have any suggestions???</p> <p><br> </p> <p>i have this implemented 100% per hs instructions -- and still get nullreferenceexceptions</p> <p><br> </p> <p>using System;<br> using System.Web;<br> using System.Web.SessionState;<br> using System.Text;<br> using System.Net;<br> using System.IO;<br> using System.Text;<br> using System.Text.RegularExpressions;<br> <br> public class EmailSignup : IHttpHandler, System.Web.SessionState.IRequiresSessionState</p> <p>{</p> <p>public void ProcessRequest (HttpContext context) {</p> <p>context.Response.Write(context.Session[&quot;id&quot;].toString());</p> <p>}<br> </p> <p>}<br> </p> <p>&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;</p> &lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt; <p>&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;</p> &lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt; 2010-07-22T22:21:29-04:003987546http://forums.asp.net/p/1574816/3987546.aspx/1?Re+aspx+sessions+being+called+in+ashx+handlerRe: .aspx sessions being called in .ashx handler <p></p> <blockquote><span class="icon-blockquote"></span> <h4>wints9er</h4> this doesnt work for me!&nbsp; anyone else have any suggestions???</blockquote> &nbsp; <p></p> <p>If you've a question, start your own thread?</p> <p><a href="http://www.mikesdotnetting.com/Article/69/How-to-get-your-forum-question-answered-avoid-thread-jacking">http://www.mikesdotnetting.com/Article/69/How-to-get-your-forum-question-answered-avoid-thread-jacking</a></p> 2010-07-22T22:29:40-04:00