Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every body:

In my website,
when the unauthenticated user press on the link that redirect to asp.net page specific for authenticated users only,

in the first time he press ,
it redirect him to the page (that is the problem),
but when the unauthenticated user press again on another link specific for authenticated users it redirect to login page or redirect it to the page which display that : Internet Explorer cannot display the webpage.

I have two questions here:

1)- In first time he press the link:
why it redirect him to the authenticated page although he is un authenticated

2)- When he press again:
why it go to page that Internet Explorer cannot display the webpage
and not to the login page

thanks........


up
Posted
Updated 13-Jan-11 11:02am
v6
Comments
Abdul Quader Mamun 16-Dec-10 22:36pm    
Spelling check.

Please explain this in your code:

XML
<deny users="?, *"/>


It is confusing, blocking all unauthorized and then block all :confused:
 
Share this answer
 
Comments
MrLonely_2 17-Dec-10 4:15am    
it is not the problem......
i change it and the problem still........
It seems like there is some setting problem in your web.config file. Check that authorization is set in web.config as below:

XML
<authorization>
    <allow users="*" />
    <deny users="?" />
<authorization>


Could you please post the code to add more detail to your question?
 
Share this answer
 
v2
Comments
MrLonely_2 16-Dec-10 23:15pm    
i added the code for u...
i am waiting..............
Thanks for your replay...

This code i added it to Global.asax page

C#
protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {
        if (Request.IsAuthenticated)
        {
            HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(
                User.Identity, Globle.GetUserRoles(User.Identity.Name));
        }
    }


and this code is under the login button:

C#
protected void btnSignin_Click(object sender, EventArgs e)
    {
        if (Globle.AuthenticateUser(txtEmail.Text, txtPassword.Text))
            FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);
    }


this code is in web.config file inside members folder:

XML
<authorization>
            <allow roles="Admin,Members"/>
            <deny users="?"/>
        </authorization>


this code is in web.config file inside admin folder:


XML
<authorization>
            <allow roles="Admin"/>
            <deny users="?, *"/>
        </authorization>


i am waiting for u and every body....
 
Share this answer
 
Comments
MrLonely_2 16-Dec-10 23:32pm    
any body here.....
the problem still
JF2015 17-Dec-10 0:02am    
Please don't post this as answer. You can edit your question using the "Improve Question" link below your question.
MrLonely_2 17-Dec-10 0:03am    
ok sorry

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900