开发者

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

开发者 https://www.devze.com 2022-12-21 19:01 出处:网络
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

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

精彩评论

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

关注公众号