Web page not detecting a logged in user/user not logging in


Hey guys
As it stands, I've created two web pages within my app. One is a login page which is simply a blank page with the login control dragged on top. Within this control I redirect to my second page which contains a set of asp:Panels that are supposed to hide/display depending on which user is browsing the page.
I've read several tutorials and at the moment, I've installed memberships/roles using the aspnet_regsql application. I've also used the web administration tool to create an 'administrators' role and create a user which is assigned to that role. I've also added a custom membership provider and role provider which connect to a remote db as I won't be keeping these details on this machine. I've tested them within the WAT and they both seem to be connecting fine.
Anyway, I tried at first by adding the <authorization> tags to the web.config and allowing the user I created, while denying all unlogged users. This worked fine and I was only granted access when I was logged in with my test account.
I then took the next step of allowing ALL users to my page, although displaying certain panels depending on which user was logged in. To do this, on the page_load, I did:
 
if(User.IsInRole("administrators")
{
    pnlTest.Visible = true;
}
else
{
    pnlTest.Visible = false;
}
This doesn't work at all as the user doesn't seem to be recognised. I also tried just doing a simple Response.Write(User.Identity.UserName); and nothing appeared.
I'm not sure why but my page doesn't seem to be detecting any logged in user, even though the authentication works on the login page and the user gets redirected fine to the new page.
Anyone know what the problem could be?
Any help is much appreciated, thanks.
 
0
alimac24
7/3/2008 9:54:09 AM
📁 asp.net.security
📃 27051 articles.
⭐ 1 followers.

💬 1 Replies
👁️‍🗨️ 1244 Views



ah nvm, I fixed it now... it was because I'd specified the wrong dir in my web.config for the 'path' attribute of the <form> tags :) 
0
alimac24
7/3/2008 1:12:54 PM
Reply: