invisible kid
03-13-2006, 07:01 PM
I have created a site with a user login system, using forms-based authentication.
On certain pages, I want users who are logged in to see certain content, e.g. at a simple level a line saying "Hello username, you are logged in".
However, when a user who isn't logged in looks at the same page, they should see different content, e.g
"You are not logged in, please click here".
Also, for the login form, I am using a user control which sits on every single page (so you can login from any page). However, I would want that to disappear once the user is logged in.
I know this simple, but I just can't work out how to do it!
I know I can re-direct the user to a secure sub-directory once they've logged in, but this would require making duplicate copies of each page (one in the root for non-logged in users, and one in the secure area for logged-in users).
As a side note, when using the line "Response.Write(this.Page.User.Identity.Name + " is logged in")" inside a class in a control, I found that this did not display the user name after the user clicked the login button, but only once the user actually clicked refresh.
Any help would be greatly appreciated.
Thanks,
Steve
On certain pages, I want users who are logged in to see certain content, e.g. at a simple level a line saying "Hello username, you are logged in".
However, when a user who isn't logged in looks at the same page, they should see different content, e.g
"You are not logged in, please click here".
Also, for the login form, I am using a user control which sits on every single page (so you can login from any page). However, I would want that to disappear once the user is logged in.
I know this simple, but I just can't work out how to do it!
I know I can re-direct the user to a secure sub-directory once they've logged in, but this would require making duplicate copies of each page (one in the root for non-logged in users, and one in the secure area for logged-in users).
As a side note, when using the line "Response.Write(this.Page.User.Identity.Name + " is logged in")" inside a class in a control, I found that this did not display the user name after the user clicked the login button, but only once the user actually clicked refresh.
Any help would be greatly appreciated.
Thanks,
Steve