Request.ApplicationPath

Discussion in 'ASP.NET / ASP.NET Core' started by Bruce, Mar 31, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Bruce

    Bruce DiscountASP.NET Staff

    Try this

    src='/Graphics/whatever.gif'


    quote:Originally posted by MSolve1

    My problem actually is that whenever I'm in a page
    inside a subdirectory, like this one:

    http://whatever.web101.discountasp.net/Admin/whateverpage.aspx

    I cant access the graphics in this subdirectory:

    http://whatever.web101.discountasp.net/Graphics/

    because Request.ApplicationPath always return a '/'

    instead of 'http://whatever.web101.discountasp.net/'

    I wish I could just use this from whateverpage.aspx:

    src='../Graphics/whatever.gif'

    but it won't allow me to do that.

    Any ideas?

    Thanks,

    MSolve1

    quote:Originally posted by bruce

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  2. Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
     
  4. How would I change it in such a way that it will return
    '/finsoftware' instead?

    Thanks in advance.

    quote:Originally posted by bruce

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  5. My problem actually is that whenever I'm in a page
    inside a subdirectory, like this one:

    http://whatever.web101.discountasp.net/Admin/whateverpage.aspx

    I cant access the graphics in this subdirectory:

    http://whatever.web101.discountasp.net/Graphics/

    because Request.ApplicationPath always return a '/'

    instead of 'http://whatever.web101.discountasp.net/'

    I wish I could just use this from whateverpage.aspx:

    src='../Graphics/whatever.gif'

    but it won't allow me to do that.

    Any ideas?

    Thanks,

    MSolve1

    quote:Originally posted by bruce

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  6. Try this in the global.asax Application_BeginRequest event:


    '****************************************GLF
    'When you install the modules they are set to run in a virtual directory.
    'If you want to run them in the root of your web application then a few Mods are needed:
    If Application("AppPath") = Nothing Then
    Dim sAbsUri As String = Request.Url.AbsoluteUri
    Dim sRawUrl As String = Request.RawUrl
    If Request.ApplicationPath = "/" Then
    Application("AppPath") = Left(sAbsUri, Len(sAbsUri) - Len(sRawUrl))
    Else
    Application("AppPath") = Left(sAbsUri, Len(sAbsUri) - Len(sRawUrl)) & Request.ApplicationPath
    End If
    End If
    'Now replace:
    ' Request.ApplicationPath
    'With
    ' Application("AppPath")
    ' this caches to root path
    '****************************************GLF



    quote:Originally posted by MSolve1

    My problem actually is that whenever I'm in a page
    inside a subdirectory, like this one:

    http://whatever.web101.discountasp.net/Admin/whateverpage.aspx

    I cant access the graphics in this subdirectory:

    http://whatever.web101.discountasp.net/Graphics/

    because Request.ApplicationPath always return a '/'

    instead of 'http://whatever.web101.discountasp.net/'

    I wish I could just use this from whateverpage.aspx:

    src='../Graphics/whatever.gif'

    but it won't allow me to do that.

    Any ideas?

    Thanks,

    MSolve1

    quote:Originally posted by bruce

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    [/quote]
     
  7. quote:Originally posted by bruce

    Try this

    src='/Graphics/whatever.gif'


    quote:Originally posted by MSolve1

    My problem actually is that whenever I'm in a page
    inside a subdirectory, like this one:

    http://whatever.web101.discountasp.net/Admin/whateverpage.aspx

    I cant access the graphics in this subdirectory:

    http://whatever.web101.discountasp.net/Graphics/

    because Request.ApplicationPath always return a '/'

    instead of 'http://whatever.web101.discountasp.net/'

    I wish I could just use this from whateverpage.aspx:

    src='../Graphics/whatever.gif'

    but it won't allow me to do that.

    Any ideas?

    Thanks,

    MSolve1

    quote:Originally posted by bruce

    The FTP path is different from the HTTP path

    Http://www.finsoftware.com

    =

    ftp://ftp.finsoftware.com/finsoftware

    For your application, Request.ApplicationPath will return /




    quote:Originally posted by MSolve1

    Hi, Guys

    I uploaded our ASP.NET project using Frontpage Extensions into the temporary URL provided on the server. However, everytime the pages
    make a call to 'Request.ApplicationPath', it always return the root path (i.e. "/").

    Here's how it is setup when viewed from an FTP program (I'm aware that it's not recommended to use an FTP program side by side with Front Page Ext. but I'm using it anyway, just to view the directory structure):

    /finsoftware

    [graphics]
    ...

    default.aspx
    ...
    global.asax
    web.config

    Example:
    src="<%=Request.ApplicationPath %>/graphics/banner_fsslogo.gif"

    Is there a special setting somewhere in the application or the
    Web server that I should change in order to make the call in the above example point to '/finsoftware' directory?

    Thanks,

    MSolve1


    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  8. not entirely sure if this is correct, but as I remember in standard HTML

    when an SRC value begins with "/" it automatically points to the root directory.

    The most likely SRC values would be:

    /graphics/whatever.gif
    or http://www.domain.com/graphics/whatever.gif

    ScHiZo
    -------------------------------
    "Hi Bob". "Who's Bob?".[?]
     
  9. In your code Infojam, this is commented out at the end...

    'Now replace:
    ' Request.ApplicationPath
    'With
    ' Application("AppPath")
    ' this caches to root path


    Does this mean you ahve to replace ALL instances of Request.ApplicationPath with Application("AppPath") throughout the site?

    In mine there are 76 instances of it, most of it in the code-behind.

    Before I change and compile, I just wanted to make sure.

    Thanks
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page