473,372 Members | 1,003 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,372 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 5240
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.