Tag: server.mappath

从其他服务器访问图像

我将图像文件放在一台服务器上,将应用程序放在其他服务器上。 我想访问该图像,在我编写的代码下面: 在default.aspx上,我有 在GetImage.aspx上,我在page_load上编写了以下代码 protected void Page_Load(object sender, EventArgs e) { // Changing the page’s content type to indicate the page is returning an image Response.ContentType = “image/jpg”; var imageName = Request.QueryString[“imgName”]; var path = “//SERVER/FOLDER/” + imageName; if ((string.IsNullOrEmpty(imageName) == false)) { // Retrieving the image System.Drawing.Image fullSizeImg; fullSizeImg = System.Drawing.Image.FromFile(Server.MapPath(path)); // Writing the […]

在业务层中使用Server.MapPath

我的业务层创建文件,需要将它们保存在我的asp.net mvc 4 web前端的App_Data文件夹中。 我可以在业务层中使用Server.MapPath来获取App_Data文件夹的物理路径。 但我想避免在业务层中引用System.Web 。 是否有其他方法可以在业务层中获取App_Data的路径?

在MVC3中使用Server.MapPath

我有代码 string xsltPath = System.Web.HttpContext.Current.Server.MapPath(@”App_Data”) + “\\” + TransformFileName 它回来了 C:\inetpub\wwwroot\websiteName\SERVICENAME\App_Data\FileName.xsl 为什么我要获取ServiceController, SERVICENAME的路径? 我想要的App_Data路径 C:\inetpub\wwwroot\websiteName\App_Data\FileName.xsl