简体   繁体   English

在asp.net MVC URL中传递Active Directory用户名(DOMAIN \\ etc)

[英]Pass in Active Directory user name (DOMAIN\etc) in asp.net MVC URL

I'm trying to pass an active directory user name in to a asp.net MVC application, but can't figure out what's the best way to deal with the backslash in the user name. 我正在尝试将活动目录用户名传递给asp.net MVC应用程序,但无法弄清楚处理用户名中反斜杠的最佳方法是什么。

For example, say my user name is "EUROPE\\george.collins" and I want my record for 2012: 例如,假设我的用户名是“ EUROPE \\ george.collins”,而我想要我的2012年记录:

http://application/2012/EUROPE\\George.Collins

If I URL-encode the backslash as %5C the server is returning a "400 Bad Request". 如果我将反斜杠URL编码为%5C,则服务器将返回“ 400错误请求”。

Should I just separate the DOMAIN and User Name parts, eg 2012/EUROPE/George.Collins? 我是否应该仅将DOMAIN和User Name部分分开,例如2012 / EUROPE / George.Collins?

In that case, what would be the easiest way to re-combine them into a username string? 在这种情况下,将它们重新组合为用户名字符串的最简单方法是什么?

G G

I think I've found my answer here: How to URL encode parameters in ASP .NET MVC 我想我在这里找到了答案: 如何在ASP .NET MVC中对参数进行URL编码

It looks like I have to leave the user id parameter out of the route pattern, so that it will be appended as a querystring ?userid=... where the URL encoding is valid. 看来我必须将用户ID参数保留在路由模式之外,以便将其附加为查询字符串?userid = ...,其中URL编码有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM