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
0
votes
1 answer

How to open the downloaded file in new browser window c#

i am trying to open the downloaded file from database in a new browser window.. here is code that i tried.. result = objBL.GetLetter(LetterID, refNo, attachmentType); if (result != null && result.Rows.Count > 0) { …
thiru
  • 173
  • 1
  • 4
  • 16
0
votes
2 answers

How change server map path and file name when file uploaded in asp.net mvc?

I am trying to save picture in folder and store path in database using entity framework in asp.net mvc 5. I did it but I have some problems . image path in DB saved like this : C:\Users\Shima\Documents\Visual Studio…
shm
  • 439
  • 2
  • 11
  • 25
0
votes
0 answers

How to Resolve System.web.Httpcontext.Server.MapPath Reference missing

I have to create Folder at server with the help of Server.MapPath method in C# but i can't Use HttpContext Class in project, any solution? System.IO.Directory.CreateDirectory(Server.MapPath(@"~/pix/")); it not allow me to use Server.MapPath method
0
votes
1 answer

How to save to a child folder using Server.MapPath()

I am creating a new PDF with iTextSharp and saving it to a folder on my server. The following line of code will save it into the folder (called XFolder in the image below) containing my classes using Server.MapPath(): Dim wri As PdfWriter =…
0
votes
1 answer

Server.MapPath with ISS

Server.MapPath is not showing my files with IIS 7.here is my simple code: @{ Layout = null; } @{ string imgPath = Server.MapPath("~/Views/Home/anim.jpg"); }
malkovich
  • 1
  • 4
0
votes
1 answer

how to pass a folder path to mvc controller

I am trying to pass a folder path to a download controller using @Html.ActionLink, but I am getting could not find the location error like Could not find file 'C:\Teerth Content\Project\Colege\WebApp\Media\@item.Content' However when I give the…
Teerth
  • 169
  • 3
  • 5
  • 19
0
votes
1 answer

loading an xml in web apps directory from a library dll

my web application has an xml file here: /files/xml/test.xml I need to load a XDocument from within a class library project, how will I reference the xml? I don't want to pass any path parameters to this method. I want to assume the location is…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
0
votes
0 answers

Can I know a method which is equivalent to "HttpServerUtility.MapPath" in silverlight(xaml)

I want a method which is equivalent to ""HttpServerUtility.MapPath" in silverlight(xaml) which returns the physical file path that corresponds to the specified virtual path. In Web app i used: LocalPath = Server.MapPath("~/default.aspx"); But i…
anjali
  • 1
  • 2
0
votes
1 answer

Error with HttpContext.Current.Server.MapPath()

I'm using this code as part of class which should connect to an Access database: string path = HttpContext.Current.Server.MapPath("App_Data"); The App_Data folder is in the project, and contains the database, but somehow the MapPath() returns…
0
votes
0 answers

Server.MapPath giving inconsistent output

In my C# Application, inside Application_Start function of Global.asax (D:\inetpub\wwwroot\projectApp\Global.asax), I used Server.MapPath with path as "config\config.cfg". String absPath = Server.MapPath("config\config.cfg"); It was working…
0
votes
3 answers

getting absolute path in c# for navigation

I have created an MVC app in c#, It has different menus and sub-menus. The problem I am facing is that of navigation , the routing link looks like this http://localhost/menu/1 http://localhost/submenu/5 http://localhost/submenu3/1 I cant just…
0
votes
3 answers

How to use Server.MapPath for Excel File

Using Asp.Net MVC. I have one Excel file which has default styles, borders etc and it's name is MyExcel.xlsx. It opens "C:\Users\myusername\Documents" from my local. Here is my C# code for it: Application excel = new Application(); …
kojirosan
  • 497
  • 10
  • 25
0
votes
1 answer

How do you refer to ASP.NET "Content" for compatibility with testing?

Given an ASP.NET project with some files in the structure that have Content listed as their Build Action, how does one refer to that content in a manner that works both for IIS and Visual Studio's testing suite? Our old/existing practice is to refer…
svidgen
  • 13,744
  • 4
  • 33
  • 58
0
votes
1 answer

server.mappath returning wrong path

Sever.mappath is returning wrong path that is I think it is converting the initial part of the path to lowercase which is the problem; String path = Server.MapPath("~/UploadImages/"); When I check for the path in my page by storing it in a textbox…
user3642625
  • 57
  • 1
  • 1
  • 8
0
votes
0 answers

ASP Web API create directory on server gives access denied

I'm trying to create a directory on the server for saving files as links, when I create a directory it gives access denied to the file path. This is how I do it public static string CreateFile(string FilePath) { string Path = ""; …
1 2 3
8 9