473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MapPath not working with ASP.NET MVC

Hello,

On a class method I have the following:

HttpContext.Current.Request.MapPath("Data/Assets.xml");

I call this function from a View named "Document/New" which controller
is DocumentController and I end up with:

Could not find a part of the path 'C:\Documents and Settings\Me\My
Documents\Visual Studio\MyApp\Document\Data\Assets.xml'.

Where the correct path should be:

'C:\Documents and Settings\Me\My Documents\Visual Studio\MyApp\Data
\Assets.xml'.

How to solve this?

Thanks,

Miguel
Jul 21 '08 #1
1 5241
On Jul 21, 1:09*pm, shapper <mdmo...@gmail.comwrote:
Hello,

On a class method I have the following:

HttpContext.Current.Request.MapPath("Data/Assets.xml");

I call this function from a View named "Document/New" which controller
is DocumentController and I end up with:

Could not find a part of the path 'C:\Documents and Settings\Me\My
Documents\Visual Studio\MyApp\Document\Data\Assets.xml'.

Where the correct path should be:

'C:\Documents and Settings\Me\My Documents\Visual Studio\MyApp\Data
\Assets.xml'.

How to solve this?

Thanks,

Miguel
Hi,

This is the wrnog NG, you should post this in the ASPNET NG or in the
MVC forum
Jul 21 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: John Rebbeck | last post by:
I've got the directory f:\Company\Product set as web shared so it's got a virtual directory in the default web site on my test server's IIS. If I try to use Server.MapPath in that site it returns a...
5
by: Ahmed El Lakani | last post by:
hi all, i've a legacy ASP.NTT code that works fine, but now i'm trying to add new feature so i get the files from our source safe and put them in "d:\Projects\mySite" and created a new...
24
by: Lovely Angel | last post by:
Dear Friends Hope you doing great. I have recently shifted to a webhost which is Using Windows 2003 and IIS 6. Now my application was working fine earlier but now I am facing this problem ...
7
by: laura | last post by:
I'm trying to understand fully Server.MapPath. I am writing an intranet for a small company and want to be able to put some files accessible to all, hyperlinked from the intranet and therefore,...
4
by: Mark Horrocks | last post by:
Hi, Whilst trying to solve another problem (see my post yesterday please!) I have come across something strange. I created an ASP version and an ASPX version of the same code, and ran it in the...
10
by: Kenneth P | last post by:
Hi all, I have an Access database and try to create a connection to it using the Server.MapPath method. I have the app lib in c:\inetprub\wwwroot\apps\myApp and the database in...
1
by: Alan Silver | last post by:
Hello, I have the following line of code in a script... litMsg.Text = Server.MapPath("/"); where litMsg is an ASP.Net Literal control. When I try and run this page, I get the error ... ...
2
by: Scott | last post by:
Hi there, I am writing a webservice and am wanting to use Server.MapPath to get the path to some files on the server that is hosting the webservice. I am using VB.NET atm, but am learning C#, so...
3
by: Cozmo | last post by:
We have an .asp application , located in: e:\myapp In there we have directories like: e:\myapp\db e:\myapp\images e:\myapp\utils e:\myapp\working
3
by: rn5a | last post by:
Server.MapPath returns the physical file path that corresponds to the specified virtual path whereas Request.MapPath maps the specified virtual path to a physical path. Assuming that a file named...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.