Making 'View Browser' use the IIS site instead of built in?

Last post 06-27-2005 6:14 PM by BradleyB. 3 replies.

Sort Posts:

  • Making 'View Browser' use the IIS site instead of built in?

    06-23-2005, 8:49 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    Good evening...

    Is there a way that i can make Studio 2005 use the IIS site defined for it instead of using the built in web server when i right click on a file and say "View in Browser"?

    Reason that drives me crazy is because it insists on putting it one folder deep off the root if you use 2.0's built in server

    "If you make it idiot proof, they'll build a better idiot"
  • Re: Making 'View Browser' use the IIS site instead of built in?

    06-24-2005, 10:08 AM
    • Contributor
      3,285 point Contributor
    • ByReckon
    • Member since 02-14-2005, 6:27 AM
    • El Puerto, Spain
    • Posts 651
    Hello MorningZ,

    I read a post here where was stated that when creating a "New Web Site" you must select IIS as the location for the files.

    Maybe this link helps you.
    VB .Net Coder - Apologize my C# nescience
    Best Regards.
  • Re: Making 'View Browser' use the IIS site instead of built in?

    06-24-2005, 10:33 AM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    yeah, that was done during initial setup of the project, but when i right click on an aspx file in Solution Explorer, it still fires up the "built in web server" and (and the part following in bold is the part i despise) opens up the URL  http://localhost:XYZ/files/page.aspx, where XYZ is the random port Studio picked

    The "files" directory is the issue, as it breaks all links/images that i don't have defined with the "~"

    I just want "View in Browser" to open http://localhost/page.aspx, which is how it is defined in IIS.. i have no "files" virtual directory...

    but the files themselves exists in

    c:\Projects\ProjectName\files

    and IIS home directory is pointed at "files" and not at "ProjectName".. i don't know why Studio insists that it is

    "If you make it idiot proof, they'll build a better idiot"
  • Re: Making 'View Browser' use the IIS site instead of built in?

    06-27-2005, 6:14 PM
    • Participant
      1,171 point Participant
    • BradleyB
    • Member since 11-06-2002, 10:53 AM
    • Posts 227
    The View is browser command has different behavior depending on how you opened the site.  When you select File/Open/Website, type in http://localhost/YouWeb.  Then View in browser will use that.  If you use File/OpenWebsite browsing to a folder on disk then View in browser will attempt to launch the built in server against that path.  So as long as you open your site as a IIS localhost web it will do what you want.

    You can verify how you opened your site by looking at the path in the root node in solution explorer.  If it says c:\Project\ProjectName then it's a disk based web and VS will use it's built in server. If it says http://localhost/ProjectName then it'll use IIS.

    From the way you describe the behavior it sounds like you're opening the site as c:\Projects\ProjectName.  Not only will this result in the behavior you described with "View in Browser" but could also result in inaccurate intellisense.  VS will use whatever folder you open as the app root for the site.  So in your case VS thinks c:\Projects\ProjectName is the app root instead of c:\Projects\ProjectName\files.  That can cause VS to incorrectly handle intellisense, references, special folders such as ~/bin, ~/App_Code, ~/App_WebReferences, etc...  The best thing you should do is open the site as http://localhost/ProjectName

    If for any reason you really want to open the site using c:\Project\ProjectName\files instead of http://localhost/ProjectName and you want to force it to use IIS always you can change the start options by right clicking on the root node of your website, selecting property pages, then Start Options.  Change the Server Setting to Use custom server and supply the base url for your site, such as http://localhost/ProjectName.

    Hope this helps,
    Brad
Page 1 of 1 (4 items)