locked
virtual application path is defaulting to root RRS feed

  • Question

  • User430178104 posted

    Hi,

     I deployed an application in iis and this contains many virtual applications. if there is any path in virtual application like (../) it is looking in root application but i want it should look in virtual application

    Thursday, April 27, 2017 7:13 PM

Answers

  • User-1509636757 posted

    Try:

    <a href='<%= Page.ResolveUrl("~/Admin/User.aspx") %>'>User</a>
    Server.MapPath("~/Common/Template.XLSX"), FileMode.Open, FileAccess.Read);

    In above example it is assumed that Admin and Common are the folders on root of your application

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 30, 2017 6:30 AM

All replies

  • User-2057865890 posted

    Hi pathipati,

    I deployed an application in iis and this contains many virtual applications. if there is any path in virtual application like (../) it is looking in root application but i want it should look in virtual application

    You can easily rewrite the requests of root to the virtual directory,

    http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

    Besides, please consider posting IIS related questions to  http://forums.iis.net/

    Best Regards,

    Chris

    Friday, April 28, 2017 5:47 AM
  • User-1509636757 posted

    if there is any path in virtual application like (../) it is looking in root application but i want it should look in virtual application

    This usually should not happen, however; can you post some code where you are facing this issue (this could be an issue in case if you use MasterPages)? I suggest to use Page.ResolveUrl

    Friday, April 28, 2017 5:53 AM
  • User430178104 posted

    Hi,

    Below is my Code..

    <a href="../Admin/User.aspx">User</a>
    
    Server.MapPath(@"\Common\Template.XLSX"), FileMode.Open, FileAccess.Read);


    Saturday, April 29, 2017 2:39 PM
  • User-1509636757 posted

    Try:

    <a href='<%= Page.ResolveUrl("~/Admin/User.aspx") %>'>User</a>
    Server.MapPath("~/Common/Template.XLSX"), FileMode.Open, FileAccess.Read);

    In above example it is assumed that Admin and Common are the folders on root of your application

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 30, 2017 6:30 AM
  • User430178104 posted

    Thanks kaushalparik!! Got it.

    May i know how to add the styles in that case. i am adding the stylesheet like below

    <link rel="stylesheet" href="../assets/styles/User.css" />

    Tuesday, May 2, 2017 2:28 PM
  • User-1509636757 posted

    <link rel="stylesheet" href="../assets/styles/User.css" />

    I assume assets is a folder on root of your application. Considering this, you can try:

    <link rel="stylesheet" type="text/css" href="<%= Page.ResolveUrl("~/assets/styles/User.css") %>" />

    Tuesday, May 2, 2017 4:30 PM