Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » .NET Programming (VB 2010 or earlier) » ASP.NET » How to stop anyone to open a login page url...


How to stop anyone to open a login page url...Expand / Collapse
Author
Message
Posted 1/17/2009 11:20:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/17/2009 11:05:38 AM
Posts: 3, Visits: 1
i have created a login page in asp.net using c# and when i open that page after validation then the url address is opened in a new browser even after i close that window by clicking sign out button. that page can be opened by just copying that url address even after i sign out.

how to stop it? serious answer please.

disney dvds
, los angeles seo
Post #26756
Posted 1/19/2009 10:38:54 AM
Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: 7/15/2011 3:57:36 PM
Posts: 371, Visits: 208
You need to create a Session or ViewState variable to determine if the user is logged in or has a valid userID.  You can replace Session("UserID") with ViewState but ViewState scope is limited to the life of the page, session("") is limited to life of the sign in assuming after sign out you clear the session.

You could call it something like Session("UserID") = xUSERID

In the page load of each page after login you write something like this:

{
    if (Session("UserID") != null && Session("UserID") > 0) {
    }
    //load your variables do your stuff
    else {
    }
    //Redirect to login page
}

Good Luck

TallOne

Post #26775
Posted 2/11/2009 5:56:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2/11/2009 5:56:27 AM
Posts: 1, Visits: 2
Hi... I am using ASP.NET 2.0  (coding thru VB) with SQL SERVER 2000. I have used the  given code, but still d same problem occurs & Session is not getting over.I've also  used Session.Abandon() on the logout button,bt not working,I want 2 disable the navigation buttons,wen i log out the page.... Plz reply asap....
Post #26973
Posted 2/12/2009 12:10:33 PM
Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: 7/15/2011 3:57:36 PM
Posts: 371, Visits: 208
Is this new window in the same domain? 

Why not redirect? 

How are you opening the new window?  You may need to pass query string params to the new window and evaluate.

Post your code and I'll take a look.

TallOne

Post #26994
Posted 3/4/2009 9:32:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/22/2009 3:17:25 AM
Posts: 1, Visits: 6
Read up on sessions.

Your 'signout' button is not killing your users session so when you reenter the url the browser is reading the active session and believes the users is still vaild.

if your are using the asp.net login controls make sure that you have it setup correctly

Refrigerator Filters Humidifier Filters
Post #27173
Posted 4/12/2010 8:19:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/12/2010 8:35:17 PM
Posts: 1, Visits: 4
I was having the same problem, but I just put in the code that TallOne suggested and it works great. It is simply a matter of having the page redirected to the login page. The sign out button will work just fine when using the redirect. However, I am having another problem, when I sign out and click the back button, it brings everything back up. I found a code that works great on IE8, but doesnt work on Mozilla. Does anyone have a code to prevent browser back button click after sign out? for Mozilla that is? Appreciate the help in advance, thanks.

RO Water Systems
Post #29148
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 11:07pm