locked
website problem in (URL) while Upgrading from VS 2008 to VS 2013 RRS feed

  • Question

  • User337648780 posted

    Hi All, I'm upgrading my project from Visual Studio 2008 to Visual studio 2013 Ultimate.

    My project contains website while debugging the website pages using IIS express as default most of URL in the website get errors.

    In Addition using of (Request.ApplicationPath) returns "/".

    Issue Description:

    VS 2008: -

    For ex:

    we can access web site: <<http://localhost>> :<< Port>>/<<applicationfolder>>/<<pagename>>. </pagename></applicationfolder>

    <applicationfolder><pagename>VS 2013 :-</pagename></applicationfolder>

    <applicationfolder><pagename>For ex: </pagename></applicationfolder>

    <applicationfolder><pagename>we can access web site: <<http://localhost>> :<< Port>>/<<page name="">>. </page></pagename></applicationfolder>

    <applicationfolder><pagename><page name="">http://localhost:<<port>>/ : reference to the application folder </port></page></pagename></applicationfolder>

    <applicationfolder><pagename><page name=""><port>Please i need some help to solve this issue for urgent. </port></page></pagename></applicationfolder>

    <applicationfolder><pagename><page name=""><port>Thanks in advance</port></page></pagename></applicationfolder>

    Sunday, March 30, 2014 8:44 AM

All replies

  • User-1454326058 posted

    Hi Refat,

    First, based on my test on the new website application, the Request.ApplicationPath returns “/”.

    If you want to get the whole path, you could use Request.Url.

    For the URL issue of website, I think the physical path of that website is incorrect. I suggest that you could configure it to use the IIS and change the start option to select Start URL option or use the custom server.

    On the other hand, you could create a new website and add the necessary files to it.

    Thanks

    Best Regards

    Monday, March 31, 2014 3:13 AM
  • User337648780 posted

    Thanks for your kind reply,

    First of all, my base problem that I'm upgrading exist big website in big solution.

    And I have lots of using [Request.ApplicationPath - Server.MapPath - ~ ] in addition all links that load all JS and CSS files in this web site.

    Suggested solution for using Request.ApplicationPath for ex:

      private String GetApplicationPath()
        {
           string applicationPath = String.Empty;
            if (Request.ApplicationPath == "/")
            {
                applicationPath = Request.Url.GetLeftPart(UriPartial.Authority);
            }
            else
                applicationPath = Request.ApplicationPath;
    
            return applicationPath;
        }

    I have tried to solve this issue by hard code but this is wrong way because of this solution just for allow me to debug this website one VS 2013

    And i think it will effect on website performance on publish package because it will be useless.

    So, I have searched for bit of IIS Express configuration to fix this issue, or any other solution.

     

    Monday, March 31, 2014 4:32 AM
  • User-1454326058 posted

    Hi Refat,

    The value of Request.ApplicationPath is based on the website that in the IIS.

    If we are create an application under a website (E.g. Default Web Site), the value of Request.ApplicationPath is /Alias.

    If we just create a website in the IIS, the value would be /.

    If we create a website in the VS, it will create a new website in the IIS Express directly, so the value is /.

    As far as I know the path of JS and CSS files are the relative path, we needn’t to dynamic to get the current website path.

    On the other hand, if we have the code that just run in the debug mode, we could use this code below:

    #if DEBUG
    //your code
    #endif

    Thanks

    Best Regards

    Monday, March 31, 2014 11:30 PM
  • User337648780 posted

    Thanks again for your reply

    Your reply illustrate exactly the problem that lies in difference between IIS express and Asp.net development server

    Go through this link:

    Disadvantages of Using IIS Express

    In section of: Resolving References to Root-Level Resources when Deploying to Production.

     If we want to edit host configuration in IIS express for any website in C:\<UserDefiend>\Documents\IISExpress\config\

    We can edit in applicationhost file.

     <site name="ForTest" id="3">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
              <virtualDirectory path="/" physicalPath="C:\Users\refat.monir\Documents\Visual Studio 2013\WebSites\ForTest" />
            </application>
            <bindings>
              <binding protocol="http" bindingInformation="*:2693:localhost" />
              <binding protocol="https" bindingInformation="*:44300:localhost" />
            </bindings>
          </site>

    I have tried to edit the virtual path in application section but it gives error while debugging also.

    If there any other ideas

    Thanks

    Tuesday, April 1, 2014 4:35 AM
  • User-1454326058 posted

    Hi,

    Refat Monir

    I have tried to edit the virtual path in application section but it gives error while debugging also.

    What's the error that you get?

    On the other hand, I suggest that you'd better copy the project to other location instead of in the user's folder. (It maybe has the permission issue.)

    If you are create a application that under a website, the code will be like this:

    <site name="Default Web Site" id="1" serverAutoStart="true">                <application path="/MyMVC4" applicationPool="DefaultAppPool">
                        <virtualDirectory path="/" physicalPath="XXX" />
                    </application>
                    <application path="/WebSiteAPP2013" applicationPool="DefaultAppPool">
                        <virtualDirectory path="/" physicalPath="XXX" />
                    </application>
                    <bindings>
                        <binding protocol="http" bindingInformation="*:80:" />
                    </bindings>
                </site>

    Thanks

    Best Regards

    Tuesday, April 1, 2014 5:27 AM