开发者

issue with Response.Redirect while using masterpage

I am developing a project using C#.net. Here in master page I have a button for search which will redirect to different pages in the project.

I am using "~/searchpage.aspx" for redirecting to other pages which some pages are in root fol开发者_如何学编程der and sub-root folders. All pages are inheriting the master page file.

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

The above code breaking in some scenarios. which is the best approach to redirect to other pages from master page.


Response.Redirect uses client relative URLs (it's setting the HTTP Location header), as such, you don't need the preceding ~.

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


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


could you try
Response.Redirect(Page.ResolveClientUrl("/testSearch.aspx"));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜