简体   繁体   English

成功登录后如何将用户的用户名/ ID添加到URL?

[英]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.

相关问题 如何获取登录用户名 - How get logon username 如何在Windows中为当前用户的登录会话获取唯一ID-C# - How to get a Unique ID for the current user's logon session in windows - c# 成功登录google maps v3 c#后,如何显示用户名? - How to display the username of a user after successful login in google maps v3 c#? 如何获取Windows服务的LogOn用户的安全令牌? - How to get security token of a windows service's LogOn user? 如何在使用缓存登录凭据将用户登录到应用程序之前让ADAL检查用户名 - How to get ADAL to check username before using cached login credentials to logon user to application 通过用户名查找计算机名称(检查用户登录的位置) - Find computer name by username (check where the user is logon to) 获取登录用户ASP.NET MVC的用户名 - Get username of logon user ASP.NET MVC 登录表单后在标签上显示用户名和用户ID - Show username and user id on Label after Login Form 登录后如何在徽标下添加“用户名” - How To Add “Username” Under Logo After Login Blazor - 登录成功后如何调用方法设置用户数据 - Blazor - How to call method to set user data after successful log in
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM