Questions tagged [server.mappath]

The Server.MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.

131 questions
1
vote
1 answer

System.UnauthorizedAccessException loading file from Disk

Really weird problem loading a file from disk: string path = HttpContext.Current.Server.MapPath("~/Datasets/blob.xml"); FileStream stream = new FileStream(path, FileMode.Open); Throws exception: An exception of type…
user648490
  • 41
  • 3
1
vote
3 answers

How can I use Server.MapPath to upload a file onto a server which is mapped on my computer

So far I know how to upload a file to a folder within my solution using the code below. string root = HttpContext.Current.Server.MapPath("~/upload"); How can I save the file to a different location that is not within a solution i.e to a server…
Junta
  • 23
  • 4
1
vote
1 answer

Server.MapPath C# works locally but not from server

having a big of an issue with with Server.MapPath in that I can't get it to resolve from server and unsure how to test what it's trying to do. Locally, it works fine in a whole variety of different ways, but when I put it up to the server, each and…
user7528326
1
vote
2 answers

Map path in Quartz.net in ASP.NET & C#

I am using Quartz.Net in Asp.Net C# to schedule my task. I want to write to a file, when I try without the MapPath it's writing to the file as expected (Hello world). Here is the code what I wrote. I have tried HostingEnvironment.MapPath and…
user4576114
1
vote
1 answer

Server.MapPath not working

I'm trying to access files in a virtual directory I created in IIS for the first time but am getting weird results. OS: Windows XP Pro IIS: 5.1 Development Platform: Visual Studio 2008 Language: C# Virtual Directory Name: portal Local Path:…
1
vote
1 answer

server.mappath resolve referenced file path to relative dir

In my mvc application, I'm trying to serve an html page like this return File(Server.MapPath("~/Documentation/" + decoded["version"].ToString().Trim() + "/" + "index.htm"), "text/html"); The entry point index.htm includes some js scripts.
tergd1
  • 557
  • 6
  • 19
1
vote
1 answer

file.saveas in local (debug) mode getting "Not Rooted" Error. ASP.net C#

Basic function: Users upload their (local) images to (remote) my website. How to DEBUG while in local mode without getting "Not Rooted" Error? I want to be able to save/edit/copy/move to the same directories on the web server. While running on the…
Michael Wood
  • 99
  • 1
  • 3
  • 12
1
vote
1 answer

I want to access Images which is outside of the server

I'm gonna implement this on asp.net and my problem is I have some images in some others folder i can access those in run command in from windows explorer but i need to put those images to WEB and browse them automatically. But i tried to do it it…
1
vote
4 answers

Question Mark in Querystring with Server.MapPath returning an error

I am working on a web application. Here I am storing attachments/uploads on server physical directory. The parent folder of uploads may contain special characters like '?' Example of URL "~/ChapterFiles/Capgeminisdfsdf_BE CSE…
Wasif Subzwari
  • 199
  • 3
  • 13
1
vote
0 answers

Dowload file from Server

How I can download a file from a server using WebClient ad Server.MapPath and dowload it to Desktop? Example: WebClient Client= nre WebClient(); Client.DownloadFile(Server.MapPath("~/Files/")+fileRoute,@"~/Desktop/"+fileName);
Marta89sev
  • 11
  • 2
1
vote
3 answers

Calling WebService From Same Project

I'm trying to call an asp.net webservice from the same project it's in: [MethodImpl(MethodImplOptions.Synchronized)] public static void OnFileCreated(object source, FileSystemEventArgs e) { trackdata_analyse rWebAnalyse = new…
Yehia A.Salam
  • 1,987
  • 7
  • 44
  • 93
1
vote
1 answer

Map Virtual path to physical path

I have an issue with the method Server.MapPath. I am currently using the method HttpContext.Current.Server.MapPath("MyPath") to obtain the physical path of "MyPath" in an ApiController, get method. If I try to use the same method in an…
user2399378
  • 829
  • 2
  • 10
  • 23
1
vote
1 answer

Server Map Path save problems when using IE or Safari

I have created an intranet application and am having some difficulties with IE and safari on windows when trying to use the following code to save a posted file to an internal folder within the MVC solution folder…
Jay
  • 3,012
  • 14
  • 48
  • 99
1
vote
4 answers

ImageUrl trying to display an image outside of project root

I am working with two different web sites in asp.net. In the first project i upload some images to a specific folder under the project root and save just the filename in the database, now i am trying to display this images at some page of the second…
Blerta
  • 2,170
  • 5
  • 23
  • 34
1
vote
1 answer

Server.MapPath on a remote server

I have 4 front end servers. Only one of those servers (lets call it server A) has a bunch of images and documents. Now, I have this line of code that works in a single front end environment HttpContext.Server.MapPath("/temp"); Now, what I'd like…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
1 2 3
8 9