Prevent redirection from the browser bar

时间:2017-08-05 10:54:32

标签: c# asp.net

Running an aspx page

http://localhost:30894/StaffPanel.aspx

Whenever I run my project. I realized that a user can actually just changed the page name to get to another page like

http://localhost:30894/AdminPanel.aspx

How will I be able to prevent the user from being redirected?

1 个答案:

答案 0 :(得分:1)

You can not.

In other hand, you should have some user system with login and special roles. Then if user is not logged in or does not have special admin role, you show him access restricted message.

WORKAROUND, NOT RECOMMENDED: And if you need to do it fast, you can add just special parameter, like key, http://localhost:30894/AdminPanel.aspx?key=somesecrectpass to be able to access page.