How to call an ASPX page from a CLASS class (inside a class)

I want to call or redirect an ASPX page from a CLASS file or inside a class function, please help me or give a hint for this or Please write instructions to call or redirect an ASPX page from or in a class of a class

+4
source share
2 answers

You just do:

HttpContext.Current.Response.Redirect("~/myPage.aspx") 

Pay attention to 2 things:

1) you can use tilde (~) to indicate the root of the application

2) this (by default) will cause a thread interrupt exception. You can eliminate it by the olverload method with false .

 HttpContext.Current.Response.Redirect("~/myPage.aspx",false) 

3) you must add using System.Web;

+8
source

CLASS should consist of System.Web.UI.Page, inside your class you can use this method below.

 HttpResponse.Redirect(string url) 
0
source

All Articles