Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detecting VB.net login

Posted on 2010-11-23
4
Medium Priority
?
801 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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