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. Business Logic and the current context

Business Logic and the current context

Scheduled Pinned Locked Moved ASP.NET
csharpquestiondesignsecurity
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.
  • A Offline
    A Offline
    Adriann
    wrote on last edited by
    #1

    Hey all, I've refactoring a site of mine from VB.Net to C# and using a more structured OO design. I have the main solution with the web project and then another project for the BLL and DAL. I'm creating a additional security class in the BLL and I want to be able to access the context of the user but I'm having a bit of a brain freeze. I know it's the HTTPContext.Context.User class but how do I inherit the this in the BLL function I've created? I've tried HTTPContext.Context but then User is not available. Any help provided would be greatly appreciated! Thanks, Adrian

    A 1 Reply Last reply
    0
    • A Adriann

      Hey all, I've refactoring a site of mine from VB.Net to C# and using a more structured OO design. I have the main solution with the web project and then another project for the BLL and DAL. I'm creating a additional security class in the BLL and I want to be able to access the context of the user but I'm having a bit of a brain freeze. I know it's the HTTPContext.Context.User class but how do I inherit the this in the BLL function I've created? I've tried HTTPContext.Context but then User is not available. Any help provided would be greatly appreciated! Thanks, Adrian

      A Offline
      A Offline
      AlexeiXX3
      wrote on last edited by
      #2

      Does this work: HttpContext.Current.User.Identity.Name

      Alexei Rodriguez

      A 1 Reply Last reply
      0
      • A AlexeiXX3

        Does this work: HttpContext.Current.User.Identity.Name

        Alexei Rodriguez

        A Offline
        A Offline
        Adriann
        wrote on last edited by
        #3

        No, I did think that would be how I could access it from the BLL but it's not available for some reason. Thanks for the suggestion though. Any other ideas? Thanks,

        A 1 Reply Last reply
        0
        • A Adriann

          No, I did think that would be how I could access it from the BLL but it's not available for some reason. Thanks for the suggestion though. Any other ideas? Thanks,

          A Offline
          A Offline
          Adriann
          wrote on last edited by
          #4

          I found the problem, basically I'm using a different project for my Business Logic so needed to import the System.Web assembly into the class to access the Httpcontext class. It's actually bad practice to use the httpcontext I guess as it then requires a web front end but in my case I'm going to use it anyway. Regards, Adrian

          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