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

Last Reply one month ago By pandeyism

Posted one month 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 one month ago.
Posted one month 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