FormsAuthentication.RedirectFromLoginPage到自定义页 [英] FormsAuthentication.RedirectFromLoginPage to a custom page

查看:232
本文介绍了FormsAuthentication.RedirectFromLoginPage到自定义页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用FormsAuthentication.RedirectFromLoginPage为用户登录并重定向到Default.aspx页面。
我想,如果一个用户名为admin做登录被重定向到页面admin.aspx

Hi i'm using the FormsAuthentication.RedirectFromLoginPage for the user login and for redirect to default.aspx page. I want that if a user called admin do the login is redirected to the page admin.aspx

这可能吗?

推荐答案

试试这个,我认为这是你会用一个简单的解决方案中获得最接近的:

Try this, I think it's the closest you will get with a simple solution:

FormsAuthentication.SetAuthCookie(username, true);
Response.Redirect("mypage.aspx"); 

这篇关于FormsAuthentication.RedirectFromLoginPage到自定义页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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