ASP.Net class file Error: Response is not available in this context

Last Reply 7 months ago By pandeyism

Posted 7 months ago

Hello Sir,

Getting below error while I'm trying to redirect to another page based on the code written in class file and calling this function in Global.asax.

Whenever the condition is satisfied i want to redirect to another page

Getting Error: Response is not available in this context

You are viewing reply posted by: pandeyism 7 months ago.
Posted 7 months ago

Hi democloud,

Use full namespace.

C#

HttpContext.Current.Response.Redirect("Test.aspx", true);

VB.Net

HttpContext.Current.Response.Redirect("Test.aspx", True)

Refer below link-

https://stackoverflow.com/questions/19612462/how-to-call-response-redirect-from-my-custom-c-sharp-class