Solved

Detecting VB.net login

Posted on 2010-11-23
4
793 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Works a treat, thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now