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

£可爱£侵袭症+ 提交于 2019-12-24 19:29:31

问题


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.

For example, say my user name is "EUROPE\george.collins" and I want my record for 2012:

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

If I URL-encode the backslash as %5C the server is returning a "400 Bad Request".

Should I just separate the DOMAIN and User Name parts, e.g. 2012/EUROPE/George.Collins?

In that case, what would be the easiest way to re-combine them into a username string?

G


回答1:


I think I've found my answer here: How to URL encode parameters in ASP .NET MVC

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.



来源:https://stackoverflow.com/questions/11429824/pass-in-active-directory-user-name-domain-etc-in-asp-net-mvc-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!