Reputation: 287
in my asp.net website I have menu control and there are those items:
<asp:menuitem ... navigateURL="~/Admin/admin.aspx">
<asp:menuitem ... navigateURL="~/Admin/search.aspx">
I want force the asp.net think (or display in web browser adress bar), that I am on admin.aspx, but actually be redirected to search.aspx. Is it somehow possible ?
Thanks.
Upvotes: 2
Views: 1179
Reputation: 63966
Doing that with the markup you showed, no, it's not possible. You'll need to either use an <iframe>
setting the src
property via javascript or you do it from code-behind using Server.Transfer
as opposed to Response.Redirect
.
Upvotes: 1
Reputation: 2764
You can setup customized routing if you would like, but that will still display "search.aspx" in the address bar. If you want to fake the admin.aspx as search.aspx, then add your search controls in to the admin.aspx page and hide the admin controls. If you are trying to "spoof" admin.aspx, like you would an e-mail address or something, then I would direct to not StackOverflow.
Upvotes: 0
Reputation: 19702
URL rewriting sounds like it's what you are after:
Failing that you might be able to build some custom logic into your page and use Server.Transfer
to change page, without changing the URL.
Upvotes: 1