The Server.MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.
Questions tagged [server.mappath]
131 questions
0
votes
1 answer
unable to access files on a different physical drive from asp.net website
My website is published under c:\inetpub\wwwroot folder and I have some large text files on D: drive that I need to access. Let's say the exact location is D:\Test\test.txt. When my website runs it keeps failing on the File.Exists() check. I have…

user1715925
- 607
- 9
- 26
0
votes
1 answer
Server.MapPath not work
I'm developing WebSiteProject with asp.net. Server.MapPath method not work but i don't get an error when upload data.
I am checking specified folder but it's empty.
My code:
fupCategory.SaveAs(Server.MapPath("~/Assets/Upload/Category/"
…

mantissa
- 147
- 3
- 14
0
votes
2 answers
Server.mappath (NOT) and domain folder outside the webspace
It is possible to connect to a MS-Access mdb that is sitting outside of IIS on a regular domain folder? We have a company-wide share (S:) and am trying to do a quick a dirty connection to an mdb in a folder there. like this:
Set conn =…

user1349089
- 127
- 6
- 15
0
votes
1 answer
ASP.NET MVC Server.MapPath giving full path in Internet Explorer
I am uploading a file with
var filename = Server.MapPath(Path.Combine("~/Content/UserContent", Path.ChangeExtension(newName,Path.GetExtension(attachments.FileName))));
attachments.SaveAs(filename);
it works great except that in Internet Explorer…

Conceptual
- 57
- 2
- 12
0
votes
0 answers
System.Web.HttpServerUtility.MapPath(String path)
I am using System.IO.File.Exists(Server.MapPath(path)) in my code. Some time when a character (:) colon is coming then Server.MapPath is throwing an exception that System.Web.HttpException: '/MyWeb/pages/javascript:void(0).aspx' is not a valid…

user1675605
- 53
- 6
0
votes
2 answers
Use Server.MapPath to load external files
I want to load an XML file which is in D: drive. This is what I used
doc.Load(System.Web.HttpContext.Current.Server.MapPath("/D:/Employee.xml"));
But it gives me an error whenever I try to run my program:
Object reference not set to an instance of…

Esha
- 391
- 1
- 9
- 37
0
votes
1 answer
how save file on server using HostingEnvironment.MapPath()
in this code iam trying to save text document on server / wwwroot folder. nothing happens :(!
if i am working on localhost and doing the same routine like this, everything works fine and i can save text document on local pc.:

r.r
- 7,023
- 28
- 87
- 129
-1
votes
1 answer
In ASP.NET MVC 5 Server.MapPath() returning path with double backslashes
In ASP.NET MVC 5, Server.MapPath() returning path with double backslashes and image file adding to my physical project "~/Images/" folder.But it is not displaying in my solution explorer even after refresh.I have tried Replace() "\" with "/" but it…

Praveen Patel G
- 342
- 4
- 13
-1
votes
3 answers
Server.MapPath problems
My problem is that I just can't seem to get the actual file of my mapPath in my foreeach loop.
foreach (DataRow item in objKat.getProd().Rows)
{
ddlImage.Items.Add(new ListItem(Server.MapPath("../img/produkter/"),…

Kasper Bramsen
- 19
- 2
-2
votes
1 answer
Changing the path in Server.MapPath
I want to put in the string name into the code so i can create a folder named by the textbox input. How can I modify this code to do that?
string name = txtUsername.Text;
string path = Server.MapPath("~/here the string name /");
if…

Aleksovski
- 1
- 1
-3
votes
1 answer
How to find a file in server based on name in c#
I have an xml named Mapping.xml stored in my local system. i am accessing in code ,in my local system like XDocument xd = new XDocument(@"D:\MVCPopup\Mapping.xml"); .But i don't think this will work if i deploy it in iis server due to the folder…

peter
- 8,158
- 21
- 66
- 119