开发者

Best way to redirect user in login.aspx page webforms try to access a page without access

I'm with a question.

Imagine, my web site is restricted in some URLs, in a login page i try to access a url than i dont have permition

And if i doesnt i need to redirect to default开发者_运维技巧 page.

which is the best choice to do?

TY


is some attribute or element than i can put on webconfig than for users without permission to access that location redirects to default page?


solved.

In login.aspx.cs pageload

protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.IsAuthenticated && !string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])) { // This is an unauthorized, authenticated request...
Response.Redirect("YOUR_PAGE_URL"); } } }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜