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
0 answers
How to call an async method to create a file on application start up
I want to create an Asp MVC application to run a code every 12 hours. This code will create a file on the server each time.
So I've made an async method and called it from Application_Start event to make a schedule and It worked fine.
My problem is…

Siamak Ferdos
- 3,181
- 5
- 29
- 56
0
votes
2 answers
Directory.GetFiles(Server.MapPath()) from dropdown.SelectedValue
I have a photo gallery that with different sets in different folders. Currently i have a different page for each set. What I want to do is use a dropdown to choose which set to display. I'm using…

Eric F
- 11
- 1
0
votes
2 answers
Server.MapPath(FileUploadControl.FileName) not returning full path + file name
I'm trying to save the path of a file (with the file name included) to a database column. Imagine my project directory is called Project, there I have a folder called Attachments.
In my code I'm doing this to upload the file to the location I…

TRI
- 21
- 1
- 4
0
votes
0 answers
How to map the Server.MapPath to a directory on a local machine or a server?
I program in C# that uploads the file contents to a directory within the website folder.The Server.MapPath method stores the file to the folder Upload which is a part of the website. If there is a server can I upload the files there by giving the IP…

Fgst
- 7
- 6
0
votes
0 answers
asp.net: load aspx file server side
I have some aspx pages that dynamically generate xml (from backcode).
I want to load that xml to a XmlDocument on another page (server side).
But using XmlDocument.load(MapPath(path)) only loads text from file, backcode is not interpreted. Is there…

tester.one
- 369
- 2
- 6
- 23
0
votes
1 answer
Unable to save to directory in azure cloud service folder
I am trying to create an Excel file using Microsoft.Office.Interop.Excel and while this seems to be working on my local machine using the following code:
//Start Excel and get Application object.
oXL = new…

Jay
- 3,012
- 14
- 48
- 99
0
votes
1 answer
FileUpload.PostedFile.SaveAs() not working on live website asp.net
I have a form in a website that does 2 simple things.
rename the file
route the file to one of 4 specific folders in a server.
The code works perfectly when I run it inside Visual Studio, however, once it goes live it just doesn't work. I do not…

Cai Cruz
- 103
- 1
- 2
- 12
0
votes
1 answer
How to deserialize the data of a json document stored locally in the project folder
A json file is stored in the Project folder.I want to deserialize data of that json document.Im getting error while fetching the path of json document.
I used this code and got error "An exception of type 'System.IO.DirectoryNotFoundException'…

Soumika
- 65
- 1
- 7
0
votes
1 answer
Could not find a part of the path 'D:\Users\*\app\PublishedWebsites\WebMatrixWebsite\Logs'
I am writing the Log files in txt using some method and logs are written efficiently during local running of visual studio code.
C:\Users\ARSLAN\Documents\Visual Studio 2015\Projects\ApplicationCheckCrone\ApplicationCheckCrone\Logs
string…

Arslan Ahmad
- 31
- 6
0
votes
0 answers
Server MapPath not working on remote server
I am using Server.MapPath to find the path for a document uploaded to a remote server, so that I can then open it. However when using it, it is returning a relative path and so rather than searching the remote server it is searching the local…

James Peel
- 159
- 1
- 3
- 11
0
votes
1 answer
Specific path to a text file on an ASP.NET server application
I would like to set a path to my text files which are stored in TextFiles folder. Project looks like that:
This application is already hosted on a website. I've tried almost every combinations of Server.MapPath like…

Cezar
- 345
- 6
- 18
0
votes
2 answers
How can i save files in folder within the IIS of outside of the Application folder in asp.net
In my web application, i have some files those are saving within application it's creating a folder for saving files but i need to save those file outside of the application and inside of IIS.how can i do this?
With in application Folder we are…
user6072031
0
votes
1 answer
How to use server path to access a file for attachment
I am trying to access a file on another server from my application. Out of application, I am able to access the files from windows explorer, but when I am using the same path in my application, I am getting the error "Could not find a part of the…
0
votes
0 answers
ASP 5 MVC 6 Server.MapPath equivalent
Did someone know what is the equivalent of Server.MapPath (in MVC 5) in MVC 6 ?
Also did someone know a good website where all the difference is listed ? especially about controller method, because i need to do a controller who override method like…

gon
- 13
- 5
0
votes
0 answers
Use server.mappath with virtual directory to download file on remote server
I am trying to download a file (example.tif) using a virtual directory (appdata) using Server.MapPath. The virtual directory points to a server separate from my web app's server (\\servername\folder).
This html works and the file downloads:

Melolune
- 21
- 6