Showing posts with label path. Show all posts
Showing posts with label path. Show all posts

Thursday, March 29, 2012

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

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)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)

Friday, March 16, 2012

Please help on this ERROR

Can someone tell me what should I do whith this error message

'C:\Inetpub\wwwroot\ABC\ABC.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.We need a little more info on how you are trying to access the file?

Code behind? And maybe a code snipet?

Thanks,

Zath
The file isn't there or the application doesn't have permissions to open the file.
yes I try to access the file by code behide
I think one thread on this subject was enough.