Last post Jul 15, 2009 03:51 PM by papabear
Jul 15, 2009 08:25 AM|epp1123|LINK
I created a custom control (dll). When I drag n drop it on the page I get the following message.
"An unhandled exception has occurred. Response in not available in this context". I googled it but I found nothing usefull.
Jul 15, 2009 09:18 AM|papabear|LINK
I suspect that your control has some code that goes Response.QueryString[...] or some such. What it is telling you is that it can not directly access the Response object. You need to reference it through HttpContext.Current
You need to change your code to say something like
In other words, replace simple Response with the HttpContext.Current.Response
Hope that helps,
Jul 15, 2009 01:28 PM|epp1123|LINK
Οκ thanks that worked. But what's the different between Request.QuerySTring() and HttpContext.Current.Request.QueryString()???
Jul 15, 2009 03:51 PM|papabear|LINK
lol, great question! The answer - NONE!
Basically the Request object that you get handed when you are writing from within an aspx page (for example) IS the HttpContext.Current.Request. It is just that you don't need to specify it since you are in the HttpContext.Current at the time. You need to
specify it when you are using it somewhere else because you might not (possibly) be in an HttpContext...