FormsAuthentication.GetRedirectUrl 需要用户名
为什么我需要将用户名传递给此方法?我只想要从表单身份验证重定向的 url...
FormsAuthentication.GetRedirectUrl
Why do I need to pass a username to this method? I just want the url that was redirected from for forms authentication...
FormsAuthentication.GetRedirectUrl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也不明白为什么它需要它。如果您查看 源代码,它只是进行空检查。如果
userName
的值为 null,则跳过并返回 null。如果存在任何非空值,它将继续,但仍然完全忽略该值。它与处理完全无关。另请注意,根据 MS 文档 并且在代码中很明显。
I don't understand why it needs it either. If you look at the source code, it simply does a null check. If the value of
userName
is null, it skips out and returns null. If there is any non-null value, it proceeds, but still completely ignores the value. It has nothing to do with the processing at all.Also note that
createPersistentCookie
is ignored, both per the MS documentation as well as is evident in the code..NET 框架很可能需要知道哪个用户被重定向。请记住,服务器端有多个用户访问同一应用程序。
如果您确实想知道,请使用 Reflector 查看 System.Web.Security。
Most probably the .NET framework needs to know which user was redirected. Remember server side there are multiple users accessing the same application.
If you really want to know, use reflector to check out System.Web.Security.