Please explain what "Empty path has no directory" means with Server.MapPath

Discussion in 'ASP .Net' started by Alan Silver, Jun 28, 2005.

  1. Alan Silver

    Alan Silver Guest

    Hello,

    I have the following line of code in a script...

    litMsg.Text = Server.MapPath("/");

    where litMsg is an ASP.Net Literal control. When I try and run this
    page, I get the error ...

    System.ArgumentException: Empty path has no directory.

    Anyone any idea what this means? I have used Server.MapPath many times
    before without error, I'm not sure why it suddenly stopped working here.

    I'm sure I'm missing something blindingly obvious and would be grateful
    if anyone could point it out!! TIA.

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jun 28, 2005
    #1
    1. Advertising

  2. Alan Silver

    Alan Silver Guest

    IN case it's of any use to anyone, I found out that the problem was
    caused by me having the following two lines in Page_Load...

    HttpContext myContext = HttpContext.Current;
    myContext.RewritePath("/");

    I'm not actually sure *why* I had those lines there, they must have been
    from something I was doing before. As soon as I removed them, the
    Server.MapPath worked fine.

    If anyone has an explanation, I would like to hear it ;-)

    >Hello,
    >
    >I have the following line of code in a script...
    >
    >litMsg.Text = Server.MapPath("/");
    >
    >where litMsg is an ASP.Net Literal control. When I try and run this
    >page, I get the error ...
    >
    >System.ArgumentException: Empty path has no directory.
    >
    >Anyone any idea what this means? I have used Server.MapPath many times
    >before without error, I'm not sure why it suddenly stopped working here.
    >
    >I'm sure I'm missing something blindingly obvious and would be grateful
    >if anyone could point it out!! TIA.
    >


    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jun 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wookie
    Replies:
    2
    Views:
    324
    Mr Newbie
    Nov 13, 2005
  2. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,162
    Juan T. Llibre
    Mar 11, 2007
  3. Lilith
    Replies:
    2
    Views:
    238
    Lilith
    May 23, 2007
  4. Replies:
    4
    Views:
    974
    Juan T. Llibre
    Oct 7, 2007
  5. windandwaves

    explain what this means

    windandwaves, Aug 24, 2005, in forum: Javascript
    Replies:
    4
    Views:
    102
    windandwaves
    Aug 29, 2005
Loading...

Share This Page