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. Context.User.Identity issue??

Context.User.Identity issue??

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesql-server
4 Posts 2 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.
  • M Offline
    M Offline
    mittalpa
    wrote on last edited by
    #1

    Hi, Environment - VB.NET, ASP.NET, SQL Server 2000. I have two folders in my web application. One is PUBLIc and other is SECURE. I am using Forms authentication to access files in SECURE folder and PUBLIC files are available to all. In one of the files of PUBLIC folder, Based on whether the user is authenticated or not, I want to display/hide certain contents. How can make use of "Context.User.Identity" to do that? I want to avoid Session Variables as using them will defeat the purpose of Forms Authentication. Please advice. Thanks Pankaj Follow your goals, Means will follow you ---Gandhi---

    B 1 Reply Last reply
    0
    • M mittalpa

      Hi, Environment - VB.NET, ASP.NET, SQL Server 2000. I have two folders in my web application. One is PUBLIc and other is SECURE. I am using Forms authentication to access files in SECURE folder and PUBLIC files are available to all. In one of the files of PUBLIC folder, Based on whether the user is authenticated or not, I want to display/hide certain contents. How can make use of "Context.User.Identity" to do that? I want to avoid Session Variables as using them will defeat the purpose of Forms Authentication. Please advice. Thanks Pankaj Follow your goals, Means will follow you ---Gandhi---

      B Offline
      B Offline
      Bill Priess
      wrote on last edited by
      #2

      What you could do is test to see if the user is authenticated: Label1.Visible = Context.User.Identity.IsAuthenticated; Also, just as a side question, how will using Session variables defeat the purpose of Forms Authentication? HTH, Bill P. Oakland, CA

      M 1 Reply Last reply
      0
      • B Bill Priess

        What you could do is test to see if the user is authenticated: Label1.Visible = Context.User.Identity.IsAuthenticated; Also, just as a side question, how will using Session variables defeat the purpose of Forms Authentication? HTH, Bill P. Oakland, CA

        M Offline
        M Offline
        mittalpa
        wrote on last edited by
        #3

        Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? :) Follow your goals, Means will follow you ---Gandhi---

        B 1 Reply Last reply
        0
        • M mittalpa

          Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? :) Follow your goals, Means will follow you ---Gandhi---

          B Offline
          B Offline
          Bill Priess
          wrote on last edited by
          #4

          mittalpa wrote: Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? Nope... The Context.User.Identity is a System.Security.Principal.IIdentity object. It is not stored in session. Using Session state variables in your app will not invalidate your Forms authentication at all. But that is more O/T... ;) Gald I could be of assitance :) HTH, Bill P. Oakland, CA

          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