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

Join 132,365 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,289 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
post 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

Go to the top of the page

PsychoCoder
post 29 Sep, 2008 - 02:10 PM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,923



Thanked 118 times

Dream Kudos: 8475

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

Go to the top of the page

nvh
post 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

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 05:04AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month