有条件的重定向登录 [英] Conditional Redirect on Login

查看:153
本文介绍了有条件的重定向登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用窗体身份验证。我的用户被重定向到一个页面(写在web.config中),当他们登录,但有些人可能没有访问此默认页面的的privilages。在这种情况下,我希望他们能够重定向到另一页,但RedirectFromLoginPage方法总是重定向到默认页面在web.config中。我如何让用户登录,然后重定向到它取决于一些条件的页面?

I am using forms authentication. My users are redirected to a page (written in web.config) when they login, but some of them may not have the privilages to access this default page. In this case, I want them to redirect to another page but RedirectFromLoginPage method always redirects to the default page in web.config. How do I make the users login, and then redirect to a page which depends on some criteria?

推荐答案

SetAuthCookie 让你发出AUTH的cookie,但保留对导航控制。之后调用该方法可以运行你的逻辑做一个典型的ASP.NET重定向到任何地方你想要的。

The SetAuthCookie allows you to issue the auth cookie but retain control over the navigation. After that method is called you can run your logic to do a typical ASP.NET redirect to wherever you want.

这篇关于有条件的重定向登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆