如何隐藏URL中的查询字符串参数 [英] How to hide a query string parameter in the url

查看:437
本文介绍了如何隐藏URL中的查询字符串参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在它的一些项目小组吧。当我在项目点击右键,如果我选择在新标签中打开我需要在新标签页中打开链接。
对于如。如果我的页面 HTTP:本地主机/我的页面
我的网格是:

I've a panel bar with some items in it. When I right click on the items and if I select "open in new tab", I need to open the link in a new tab. For eg. if my page is "http:localhost/MyPage" My grid is:

命名


  • ABC

  • BCD

  • CDE

当我点击第二项中,navigateUrl将是 HTTP:本地主机/我的页面/名称= BCD

When I click on the second item, the navigateUrl would be "http:localhost/MyPage/?Name=bcd"

这工作正常。
但我想隐藏的URL的名称。是否有任何其他的方式,我可以通过名称来下个页面的URL曝光。我可以使用会话,但不幸的是,我不能写为code为默认的上下文菜单。

This works fine. But I want to hide the name in the url. Is there any other way, I can pass the name to next page without exposing it in the url. I could use sessions, but unfortunately, I cannot write it as a code for the default context menu.

推荐答案

您可以使用的LinkBut​​ton 的对象。他们将回发,然后你可以请求重定向到所需的页面。

You can use LinkButton objects. They will postback and then you can redirect requests to desired pages.

ASPX:

<asp:linkbutton id="lnkabcd" runat="server" text="abcd" onclick="lnkabcd_clicked"/>

C#:

public void linkabcd_clicked(object sender, EventArgs e)
{
    Response.Redirect("URL OF TARGET PAGE");
}

Ofcourse这将是非常麻烦的,如果你有很多的联系。您可以使用网格(希望你使用它,你在你的问题写)和catch排事件与命令名称和命令参数属性。

Ofcourse it will be very cumbersome if you have lot of links. You can use grid (hope you are using it as you write in your question) and catch row event with command name and command argument properties.

要隐藏在浏览器地址栏的网址,你需要做的URL重写。欲了解更多关于URL重写,请访问 $ C $的CProject 这些页面和 MSDN

To hide the url in addressbar of the browser, you need to do URL rewriting. For more on URL rewriting please visit these pages on codeproject and msdn.

这篇关于如何隐藏URL中的查询字符串参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆