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. Follow

1 Replies
887 Views

Similar Articles

[PageSpeed] 29

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:

Similar Artilces:

User logged in (and logged in on all pages)
Hello, If i get a user to log in, after entering there username and password, when they go to other pages, how do i keep them logged in??? like this asp.net site, it says at the top, logged in as:Breenan, and cant see my username in the url address bar.... Any help???? Thanks again. There are many ways to store state information besides in a querystring (which shows up in the address bar)... One common one is a Session variable which acts like a global variable for the entire application. The name could also be gotten from the database, every time the page loads, or it coul...

Serious issue: parts of pages render as if the user is logged in, parts render as if the user isn't logged in
'm having a very difficult time with some of our new pages. We've moved to a web farm, and it seems in spurts it will come where parts of my page think the user is logged in, and parts think the user is not logged in. It seems to happen to an entire control. (None of the controls have OutputCache set) For example, our login control on top will appear showing the user is logged inw hen they have been redirected to RegNewUser, but RegNewUser will display instead of redirecting as if the user were actually logged in. The MachineKey option in the web.config is set to a generated SHA1, s...

User object (System.Security.Principal.IPrincipal) in my web service does not reflect currently logged on user.
I am using Forms authentication, 3.5 framework. I am calling a web method from a web form page; here is my problem: For some reason the User object (System.Security.Principal.IPrincipal) in my web service does not reflect currently logged on user. I know I am logged in correctly when I call the web service method (which I call using BeginX...X()). The weird thing is, I have other services whos methods DO reflect the currently logged in user (although these are called using AutoComplete extender, don't know why one works and the other does not).Please help  http://www.geneangelo...

Users logging in as the same user..
HI there.. I have a problem with ASE12.0 .. I have created 10 users on the database and granted everybody permissions and all.. However, it seems everybody, no matter who logs in, logs in as the same user.. For eg... I have user logins John, Alex, Alan, Steve......etc etc And i created a user group for all of them (eg developers..) However, when they log on to isql, anything that they do will be under John, no matter if it is logins John, Alex, Steve... or etc etc.. If i do a sp_who.. all the connections will be listed as John. If they create tables, all table created will ...

User Log in Log
I need to keep a daily record of network logins Being Auditcon does not work with NW6, is there a way I can enable Logging on a server/tree to capture user login? Install NSURE Audit. Configure it to record logins and out for both the server and eDir. The Nsure Audit starter pack 1.0.3 is downloadable from the website. ~+~^~+~^~+~^~+~^~+~^~+~^~+~^~ Jim Gosney Netware/Groupwise Admin./Eng. Genesco, Inc. Nashville, TN Currently reading: fiction: Lord of the Rings: Return of the King -- J.R.R. Tolkien non-fiction: George Washington -- James Burns and Susan Dunn rel...

Logging in a user onto one site logs out a user on another!
I am building a CMS application. All is on one computer during development using Visual Web Developer 2008 Express Edition and Windows XP Professional. Simply, I have one set of pages and each website's domain name points to the same pages, which load different data from the database, depending on the domain name. I am using the membership and roles framework but have left the applicationName blank in the roleManager and membership providers so that, as authenticated users create an account, a different applicationID is created for each domain name.  This way, the users and roles ...

User first log and another logs. Stats for users, etc.
Hello!I will write what I have. I have simple membership provider and login/register control. But when the new user come to site, he can sign up. After click "Finish" or "Register" button, his account is saving, but is inactivate. He also gets an email with link to active the account ( link is like: http://mysite.com/activate.aspx?id=XXXXXX, where XXXXXX is simply his GUID number, so activating user is very easy - aproove user where userId = GUID). Ok. But I have problem. How to make simply logger counter for each user ?Simply: "Hello User, this is your 123 log on this portal" My q...

Login Control logs user in, but User is not authenticated, but user really is!
I am using aspnetmembershipprovider.  Everything works fine.  I slap a login control on my login page and am able to login and get to my secure folder etc.  When I try and put some code in the LoggedIn method "User.Identity.IsAuthenticated" = false, yet if I blow through that, I am logged, authenicated etc.  The documentation says that the LoggedIn event is "after the user is authenticated".  Any Ideas what is up?Thanks,TPS------------------------------------------------------Note Collaboration for your next confernce call.http://www.ConferenceCallNotes.com I am...

user log in log file
If I open GroupWise Client, it is logged into the poa log even before I put password information. How can I ensure that the user loged in (or didn't) in that time that log shows? Thankyou in advance. -- Fabio Martins OS/CN Analyst http://fabiomartins.net What exactly do you mean? If you mean "can I know if they actually succeeeded in logging in", no. imagine 3 possbilities user logs in correctly user has bad password user just cancels 1 and 3 look identical. 2 will give an FFFF error. "Fabio Martins" <contato@fabiomartins.net>...

Redirecting a user after a user is logged in?
I am using the Login control to login a user. But I have the IsAuthenticated property of Identity object as false even after user has logged in, in Login_LoggedIn event. Also, I cannot get roles for the user in this event using Roles.GetRolesForUser. Can someone tell me how I could redirect a user based on user's role (only one role is there in my app per user) when using Login control?sun21170 Have a look into this link http://quickstart.developerfusion.co.uk/QuickStart/aspnet/doc/ctrlref/login/login.aspx Hope this will help youAshok Rajawww.iGold.inDon't forget to click "Mark...

After user logs into the site the default directs the user back to the home page.
After user logs into the site the default directs the user back to the home page. I would like to default to another page on the site after login. Anyone know what/where that setting is? I think its built into the core.  Have a look on snowcovered.com I am sure there are 3rd party modules that do what yo want. Antony ...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

Problem in getting logged in user Name for ASPX page with (even with this.User.Identity.Name)
Hi  friends,  I am creating an application that takes current logged in user and displays on the page itself. for this I am getting the user name in PageLoad function by using this.User.Identity.Name and then storing the value in a hidden variable for aspx page. I am using this hidden  variable to display the name of the user. I am using Windows authentication for this. Now problem that I am getting is that when multiple user launch the application from different machine and if they click simultaneously, name of one user appears on the paged displayed on the machine of ot...

How to Get the Currently Logged in Computer User within the Web Page
I'm creating an ASP.Net web application and the requirement is that users on our intranet ( AD-LDAP authenticated ) have the option, when first browsing to the logon page, to either be logged on through their current user account automatically, or be given a chance to log on as a different user. So the Logon page needs to be able to determine who is currently logged on to the computer. How can I do this? I have the LDAP forms-based authentication working already. Thanks Very Much in Advance.  David      Page.User.Identity.Name Curt_C: Page....

Web resources about - Web page not detecting a logged in user/user not logging in - asp.net.security

Methods of detecting exoplanets - Wikipedia, the free encyclopedia
Any planet is an extremely faint light source compared to its parent star . In addition to the intrinsic difficulty of detecting such a faint ...

Detecting unauthorized cross-app resource access on OS X
Last week, Luyi Xing, a Ph.D. student from Indiana University Bloomington and his colleagues released a research paper on several vulnerabilities ...

Neuroethology of Toads (Part 2 of 3; English): Feature Detecting Nerve Cells in the Brain - YouTube
Movie with the title "Image Processing in the Visual System of the Common Toad - Behavior, Brain Function, Artificial Neuronal Net" (IWF No. ...

Detecting and treating arthritis in dogs
Arthritis is very common in older dogs but there are ways to keep them comfortable and happy.

Detecting APT Activity with Network Traffic Analysis
Computerworld Australia is the leading source of technology news, analysis and tools for IT decision makers, managers and professionals.

Malware-detecting 'sandboxing' technology no silver bullet - Palo Alto, mcafee, trend micro, security ...
The security technology called "sandboxing" aims at detecting malware code by subjecting it to run in a computer-based system of one type of ...

Researchers close to developing a blood test for detecting Alzheimer’s
A team of scientists say they are getting closer to detecting Alzheimer’s antibodies at the preclinical stage, giving patients an opportunity ...

Threat-detecting surveillence cameras among first start-up projects to benefit from local Microsoft Innovation ...
South Australia's start-up support initiatives give funding to system that foils armed hold-ups by locking the shop doors to suspicious people. ...

Detecting APT Activity with Network Traffic Analysis
Defining Technology for Australia's IT Leaders.

Shrimp's eyes inspire new cancer-detecting camera
Shrimps' eyes have been revealed as the latest weapon against cancer, with their unique vision set to be adapted to diagnostic cameras.

Resources last updated: 12/24/2015 9:53:32 PM