带有MVC2的Windows登录磁贴 [英] Windows Login tile with MVC2
本文介绍了带有MVC2的Windows登录磁贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了一个要求,要求用户提供页面的Windows凭据。我在web.config中将身份验证模式作为Windows提供,但它无法正常工作。请给我一些建议。我在后页编写代码为
Hi,
I came across a requirement, to ask user for windows credentials for a page. I gave authentication mode as windows in web.config but it is not working. Please give me suggestion. I wrote code in back page as
string s = (Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1));
我希望这个错误。我和谷先生核实过,但没用。请指导我。
先谢谢
I hope this wrong one. I checked with Mr. Google, but of no use. Please guide me.
Thanks in Advance
推荐答案
使用HttpContext.User属性
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user(v=vs.110).aspx
因此,
Use HttpContext.User Property
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user(v=vs.110).aspx
Thus,
string user = User.Identity.Name;
这篇关于带有MVC2的Windows登录磁贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文