Solved

Detecting VB.net login

Posted on 2010-11-23
4
795 Views
Last Modified: 2012-05-10
Hi experts,

I'm writing a .net web application using visual basic and I'm struggling with the membership/login functionality.

I've got the membership database setup and have logged in after a fashon and I'm not sure if i'm doing it correctly.

Basically what I want to do is, after the user has logged in using the standard vb.net login tool and membership table lookup is navigate to a different web page and should the user log out redirect the user to the login page.  

Could someone give me a code example on how this is done?



0
Comment
Question by:MOSSPOINT
  • 2
4 Comments
 
LVL 5

Expert Comment

by:buraksarica
ID: 34195224
You can use the login Control's loggedin event. See here for example :

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin.aspx

You will just redirect the user whereever you want after he/she logges-in.
0
 
LVL 4

Expert Comment

by:Andre412
ID: 34195815
Basically you would use session variables and master page / Base Page

In you master page Load event you would check for

If Not Session("IsLoggedIn") Is Nothing AndAlso Session("IsLoggedIn") = True Then
'user can proceed , run appropriate code here
Else
 response.redirect("login.aspx")
End If

In your login page on the OnloggedIn event of the logn control you would set Session("IsLoggedIn") = true

When the user logs out you would remove the Session.Remove("IsLoggedIn")

This approach will affect site ide access
0
 
LVL 5

Accepted Solution

by:
buraksarica earned 500 total points
ID: 34196220
There is no need to use a session variable while the author is using standart asp.net membership classes and methods. You can check if the request is authenticated (which means, user is logged in) with

Page.Request.IsAuthenticated

member. Also if you place a loginstatus control to masterpage, it automatically display a login and logout buttons, and take the action you desire automatically. Please refer to the http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.loginstatus.aspx and LogoutPageUrl property of it.
0
 

Author Closing Comment

by:MOSSPOINT
ID: 34203599
Works a treat, thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question