Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,804 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,276 people online right now. Registration is fast and FREE... Join Now!




Asp Member ship providers C#

 
Reply to this topicStart new topic

Asp Member ship providers C#

nvh
29 Sep, 2008 - 01:45 PM
Post #1

New D.I.C Head
*

Joined: 29 Sep, 2008
Posts: 2

Hello Everyone,

I hope you can help me find the answer here. I am using forms authentication and using ASP.Net membership without any roles, standard out of the box setup. I have created a login page and would like to test if someone browses directly to the page (by using a book mark or something) that is already logged in and direct them to another page.

For example

Me as a user comes to my page and logs in, i then for some reason decide to go back to the login page. Normally dotNet will just display my login page. However i would like to redirect it do another page lets say. Already loggedin.aspx.

Now i allow users to view the entire site if they are logged in or not, i just need to know what the code C# would be in my page load to test if they are logged in or not.
This doesn't work
CODE

   protected void Page_Load(object s,EventArgs e)
   {
       MembershipUser member = Membership.GetUser();
       if(member != null)
            Response.Redirect("/loggedIn.aspx");
   }


If have been through so many pages that absolutely tell you NOTHING about checking if they are logged in at all. The MSDN links contain everything but what i am looking for. Help!
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Asp Member Ship Providers C#
29 Sep, 2008 - 02:10 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,997



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to ASP.NET smile.gif
User is offlineProfile CardPM
+Quote Post

nvh
RE: Asp Member Ship Providers C#
29 Sep, 2008 - 02:54 PM
Post #3

New D.I.C Head
*

Joined: 29 Sep, 2008
Posts: 2

Disregard post. Issue resolved missing Web.Config information
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 02:16PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month