Solved

Detecting VB.net login

Posted on 2010-11-23
4
798 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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