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. path urls relative to root of web app

path urls relative to root of web app

Scheduled Pinned Locked Moved ASP.NET
helpsysadminsecurityquestionlearning
3 Posts 3 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.
  • C Offline
    C Offline
    Colin Pace
    wrote on last edited by
    #1

    I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea). my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page. I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...) Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind. any help?

    C J 2 Replies Last reply
    0
    • C Colin Pace

      I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea). my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page. I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...) Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind. any help?

      C Offline
      C Offline
      Coding C
      wrote on last edited by
      #2

      I think role based security is what you are looking? If so this article might help http://www.codeproject.com/KB/web-security/formsroleauth.aspx

      Coding C# www.excitetemplate.com

      1 Reply Last reply
      0
      • C Colin Pace

        I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea). my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page. I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...) Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind. any help?

        J Offline
        J Offline
        Jeremy Likness
        wrote on last edited by
        #3

        For the full path use Page.ResolveUrl(), for a relative path (relative to the user's browser) use Page.ResolveClientUrl. Both will take in the ~ format and map it to a real path. If you are in a control, the methods are available from Control as well (Page is a type of Control).

        Jeremy Likness Latest Article: Whats in Your Collection? Part 1 of 3: Interfaces Blog: C#er : IMage

        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