Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Protect pages

Protect pages

Scheduled Pinned Locked Moved ASP.NET
question
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    isaii
    wrote on last edited by
    #1

    Hi, In oder to protect my web pages,how I will redirect all user to a log-in page to check whether they are authorize or not? I ma using vb. Thanks in advance.

    _ B 2 Replies Last reply
    0
    • I isaii

      Hi, In oder to protect my web pages,how I will redirect all user to a log-in page to check whether they are authorize or not? I ma using vb. Thanks in advance.

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      You can check the user credentials in the page load event and if not there you can redirect them to the login page. When a user logins then you can store the his credentials in session and then verify them in the pages.

      Best Regards, Apurva Kaushal

      1 Reply Last reply
      0
      • I isaii

        Hi, In oder to protect my web pages,how I will redirect all user to a log-in page to check whether they are authorize or not? I ma using vb. Thanks in advance.

        B Offline
        B Offline
        Britney S Morales
        wrote on last edited by
        #3

        Use this code to redirect all the access to login.aspx page in your site. Onto Web.config change the authentication mode protection="All"> In order to check is the user session is active you must to create a session var on login event, And checked every time you load a form (Onload event) if isnt active the session var (Wasnt create) you redirect the user to out the site (Ex: logout.aspx) Use These lines to make that i told you on the lines behind Create var Session["Active"] = "is Active"; check var private void Page_Load(object sender, System.EventArgs e) { try { string active = Session["Active"].ToString(); } catch(Exception)//If the var never was create or timeout or killed { Response.Redirect("logout.aspx"); } I hope you can step forward in your project with this solution. :-D

        keep Learning and you never will be out of date...

        I 1 Reply Last reply
        0
        • B Britney S Morales

          Use this code to redirect all the access to login.aspx page in your site. Onto Web.config change the authentication mode protection="All"> In order to check is the user session is active you must to create a session var on login event, And checked every time you load a form (Onload event) if isnt active the session var (Wasnt create) you redirect the user to out the site (Ex: logout.aspx) Use These lines to make that i told you on the lines behind Create var Session["Active"] = "is Active"; check var private void Page_Load(object sender, System.EventArgs e) { try { string active = Session["Active"].ToString(); } catch(Exception)//If the var never was create or timeout or killed { Response.Redirect("logout.aspx"); } I hope you can step forward in your project with this solution. :-D

          keep Learning and you never will be out of date...

          I Offline
          I Offline
          isaii
          wrote on last edited by
          #4

          Hi Britney.. thank you so much for your reply but I need code written in vb. Can you show? I am really sorry because I badly need a tutorial:sigh:.Thanks so much. I really appreciate it.

          E 1 Reply Last reply
          0
          • I isaii

            Hi Britney.. thank you so much for your reply but I need code written in vb. Can you show? I am really sorry because I badly need a tutorial:sigh:.Thanks so much. I really appreciate it.

            E Offline
            E Offline
            ednrgc
            wrote on last edited by
            #5

            The syntax is slightly different, the the namespaces and methods are the same.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups