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
2
votes
2 answers

Classic ASP Server.MapPath() doesn't work as expected in global.asa

In Classic ASP, Server.MapPath() doesn't always work properly in the Application_OnStart event within global.asa. I have an ASP page at "\testfolder\test.asp" within a virtual root, I have an XSLT file at "\xsl\transform.xsl". My virtual root is…
andynormancx
  • 13,421
  • 6
  • 36
  • 52
2
votes
1 answer

Server.MapPath gives wrong path, exception "The given path's format is not supported" when running on IIS server?

Currently, I'm using the codes below to save a file to a directory on my website. //save the file to the server String savePath = Server.MapPath("..\\temp\\") + file; FileUpload.PostedFile.SaveAs(savePath); When I'm running the application on my…
Leo
  • 2,173
  • 6
  • 28
  • 37
2
votes
1 answer

Getting physical path of a virtual path

I have a folder to hold images C:\inetpub\wwwroot\Images\eZone\Albums\Album1. My mvc app is in another folder C:\inetpub\wwwroot\ezone. In IIS 7, I create a virtual directory images, which maps to C:\inetpub\wwwroot\images, under ezone site. When I…
T L
  • 504
  • 2
  • 11
  • 27
2
votes
2 answers

Imported system.web, I don't see server.mapPath?

I imported system.web into my class lib project. Trying to find: system.web.httpserverutility.server.mappath But I dont' get the method in intellisense? It is a .net 2.0 build.
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
2
votes
1 answer

WebMatrix - Server.MapPath issues

I am having an issue with the server.mappath method. My current code is: var imageroot = Server.MapPath("~/Images/Property/"); var foldername = rPropertyId.ToString(); var path = Path.Combine(imageroot, foldername); When I upload this path into my…
Gavin5511
  • 791
  • 5
  • 31
2
votes
2 answers

Server.MapPath() with IIS URL Rewrite Module 2.0

I have a website in IIS, with a legacy classic asp application configured as a sub app. I'm basically trying to create URL rewrite rules so that I don't have to change all of the relative URL's in the code. e.g. URLS's such as…
Brett Postin
  • 11,215
  • 10
  • 60
  • 95
2
votes
1 answer

Server.MapPath vs Request.MapPath

Can someone please explain the difference between Server.MapPath and Request.MapPath and usage scenarios for the two ?
Nick
  • 117
  • 3
  • 11
1
vote
1 answer

Server.MapPath in Global.asax

In Application_Start event in global.asax.cs, I have added some initialization code. This code is run in a spawned thread (created using new Thread()). The initialization code uses Server.MapPath to get the physical path of a file. However many…
Viking22
  • 545
  • 1
  • 7
  • 19
1
vote
2 answers

Server.MapPath() not getting the path needed

I have a asp.net website that has the following directory: C:\Users\Desktop\Testing\src\website I have another folder called "files" that is here: C:\Users\Desktop\Testing\src\files from inside my project i am trying to read files from the "files"…
Ovi
  • 2,459
  • 9
  • 50
  • 72
1
vote
1 answer

Closing and releasing the file after use

try { using (MemoryStream stream = new MemoryStream()) { path = Server.MapPath(@"\\Files\\" + "file.txt"); StreamWriter tw = new StreamWriter(path, false, Encoding.GetEncoding("windows-1255")); …
Amen
  • 15
  • 5
1
vote
2 answers

Deleting Dynamically Populated images from a Directory (NOT GridView) ASP.NET (VB)

The code below displays a thumbnail of each image in a specific server directory and when I click on the image it pops up a nice full sized picture. It works perfectly. I would however, like to be able to delete an image. I first thought I could…
James
  • 900
  • 3
  • 15
  • 28
1
vote
1 answer

how to map a path in remote server

I have to manage the attachment in a file server. So I mapped the file server to local e: driver, and point to it directly in my program. It works fine in my working machine, but reports can not find path in the application server where I put my…
Steven Zack
  • 4,984
  • 19
  • 57
  • 88
1
vote
0 answers

I can't use Server.MapPath in c# class libary?

I need to access the folder in ~/Templates in my application. I didn't get the suggestion for server.MapPath. Why so? Also, I tried using the HostingEnvironment.MapPath and System.Web.HttpContext.Current.Server.MapPath.But it returns null. Is there…
Haritha Es
  • 185
  • 3
  • 11
1
vote
0 answers

Why Server.MapPath is adding extra directory in the path

I am using HttpContext.Current.Server.MapPath function to locate a StudentReport.rdlc file which is under a Class Library Project. Solution Structure: I am calling below function which is in Class Library Project from a Web API Project named as…
Shaiju T
  • 6,201
  • 20
  • 104
  • 196
1
vote
2 answers

vb.net - Inserting number of files named XX into a string

Have the following code which creates a table of all the images in a folder. VB: Sub Page_Load(sender as Object, e as EventArgs) If Not Page.IsPostBack then Dim dirInfo as New DirectoryInfo(Server.MapPath("/images")) …
Tom
  • 12,776
  • 48
  • 145
  • 240
1 2
3
8 9