[英]How to add the user's username / ID to the URL after successful logon?
in my web application I want the page URL to point to current user by his username/ID 在我的Web应用程序中,我希望页面URL通过其用户名/ ID指向当前用户
so when i change the username the browser moves me to the other username page. 因此,当我更改用户名时,浏览器会将我移动到另一个用户名页面。
for example like this: www.XYZcom/Member.aspx?userID="012345" 例如这样的例子:www.XYZcom / Member.aspx?userID =“ 012345”
i want to do this because i have a search method and when i click on the resulted hyperlinks, the link returns me back to my own profile, not the username i clicked on. 我想这样做是因为我有一种搜索方法,当我单击生成的超链接时,该链接将我返回到自己的个人资料,而不是我单击的用户名。
I'm using c# and ASP.NET. 我正在使用c#和ASP.NET。
I hope my question is clear. 希望我的问题清楚。
HttpContext.Current.Request.QueryString.Add()
include System.Data in your file and use HttpContext to get and set parameters to the url. 在文件中包含System.Data并使用HttpContext获取并设置URL参数。
You said that you are using c# so this is an example of using C# in the code behind file or controller. 您说您正在使用c#,所以这是在文件或控制器后面的代码中使用C#的示例。 You can also accomplish this on the client using java script, but I will wait for a response from you in regards to where you are trying to append to the url.
您也可以使用Java脚本在客户端上完成此操作,但是我将等待您的答复,以了解您尝试附加到url的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.