How do I check authentication and then redirect user based on the check?
Posted on 2014-12-06
I am using BlogEngine 3.0.. There is no code behind page for default.aspx in the web app. So I am using the site.master.cs in the theme to make the check I need. I need to check to see if the person coming to the page is authenticated and if not redirected to Login. If they are authenticated to check and see if they are an Administrator or a Teacher. If not redirect the user to a page NotAllowed.aspx. Below is the code for the code behind on the site.master.
protected void Page_Load(object sender, EventArgs e)
else if (!Roles.IsUserInRole("Administrators")) ||
This is what happens:
When I first visit the page I am sent to Login as I should be. When I log on I am just redirected back to Login. It doesn't matter what credentials I use to log in, whethr an administrator's or a teacher's.
This seems simple. I can't see what I am missing. Thanks for your assistance.