Results 1 to 3 of 3

Thread: Confused by IIS versus VWD 2008 Dev Server and System.Web.HttpRequest.ApplicationPath

  1. #1
    Join Date
    Dec 2008

    Confused by IIS versus VWD 2008 Dev Server and System.Web.HttpRequest.ApplicationPath

    Using Visual Web Developer 08 and it's inbuilt Development Server I'm working through a LINQ to XML tutorial in a book.

    This line is giving me a problem:

    XElement doc = XElement.Load(Request.ApplicationPath + "\\authors.xml");

    Request.ApplicationPath retrieves a path "E:/C10_LINQ/authors.xml" which doesn't exist.

    I thought it should get something more http-ish like http://localhost/directory/website/authors.xml

    I thought this might be due to using the inbuilt server rather than IIS so I installed IIS 5.0 on XP, which opened up a whole new can of worms because I can't get the website to run.

    I am thrashing around in the dark with evil thoughts about reinstalling software!

    I seek your help and guidance thanks.

  2. #2
    Join Date
    Aug 2005
    The Garden State
    i think you want the RequestUri property, not application path
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    Dec 2008
    Of course, thank you!

    Got it to work firstly by calming down : ) reading the rest of the chapter properly and creating the XML file in the directory on my hard drive pointed to by Request.ApplicationPath.

    Then following your suggestion:

    XElement doc = XElement.Load(Request.Url.AbsoluteUri.Replace("tutorial.aspx", "Authors.xml");

    fudged it nicely.

    And I didn't reinstall anything lol

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center