Change url on server side
When user clicked on A tag ( <a href='showSomething.aspx?id=11&key=fixed'>Bring Something</a>
) showSomethingPage.aspx will be shown with URL parameters. But I want to change URL from show开发者_开发知识库Something.aspx?id=11&key=fixed
to showSomething.aspx?key=fixed
in despite of shown the thing with id 11.
Try saving the ID in the session state and then using Response.Redirect.
Use a redirect:
C# code (put this in Page_Load or something):
Response.Redirect("showSomething.aspx?&key=fixed");
If you just want to hide the URL from the status bar your link, use the onclick event to open the URL:
a href="javascript:void(0)" onclick="window.location='showSomething.aspx?id=11&key=fixed'"
Hope it helps you. ;)
You can save the id in the session and then redirect to showSomething.aspx?key=fixed
. then showSomething.aspx?key=fixed
will read the session and file the id=11 and show it.
精彩评论