MapPath not working with ASP.NET MVC

S

shapper

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
 
I

Ignacio Machin ( .NET/ C# MVP )

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top