Problem with Response.Redirect when using homepage

I am developing a project using C # .net. Here, on the main page, I have a button for searching, which will be redirected to different pages in the project.

I use "~ / searchpage.aspx" to redirect to other pages, which some pages are in the folders of the root folder and sub-root. All pages inherit the main page file.

Response.Redirect ("~ / testSearch.aspx");

The above code in some scenarios. which is the best approach to redirecting to other pages from the main page.

+3
source share
3 answers

Response.Redirect URL- ( HTTP-), ~.

Response.Redirect("/testSearch.aspx");

+2

Response.Redirect("/testSearch.aspx");

+1

You can try  Response.Redirect(Page.ResolveClientUrl("/testSearch.aspx"));

+1
source

Source: https://habr.com/ru/post/1774507/


All Articles