English 中文(简体)
移除尿素中窒息器
原标题:Removing a querystring from url in asp.net

HI, I need to remove a querystring when a user clicks a particular LinkButton. So for example if the querystring is http://UserProfileManager.com?UserID=1234 .... when the user clicks on the Linkbutton, I want the url to be http://UserProfileManager.com. The issue is that everything is on one page, and I am using asp:panel to show and hide different areas of the webpage.

任何想法都会受到赞赏。

最佳回答

你有几种选择:

(1) 在您的法典中,如果查询含有“UserID”钥匙,就将“LinkButton s URL”设定为短地址:

if (Request.QueryString["UserID"] != null) {
    this.LinkButton.PostBackUrl = "http://UserProfileManager.com";
} else {
    // other address
}

2) 将用户信息数据库置于一个隐蔽的领域,而不是盘问。

3) 将你的意见和编辑页分开——把所有东西放在一起 *.aspx可能会造成更多的麻烦,而不是铺平公路。

问题回答

you cant actually remove a querystring from the URL. I mean to say that there is no .remove() method available for that. If you still want to do so you will have to use the .substring() method and get it done manually.

Just a tip that may prove helpful: If you are using the QueryString values to maintain different states on the same page then i would rather suggest you to keep those values in a ViewState on the page and make changes to it accordingly. This way your URL will remain clean, users wont be able to harm your flow and will work just fine.

照料!

在装页上,你可以把 que带入隐藏的盒子。

当用户点击纽顿时,案文箱便可打开

如果用户浏览器不使用文字箱中的插码,将电线贴到URL。

I hope this helps Sp

看看请求的目的——虽然我可以不记确切的财产,但有一些线性计划(将归还“http://”),但会有一个或一个组合给你所需要的东西。

进一步研究——研究请求。 乌尔都族财产。 然后,排除了电梯。 我看不出在古里/相容的班子里有确切的方法给你什么是你所期望的,但却是很困难的。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签