473,400 Members | 2,145 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,400 software developers and data experts.

Change in MapPath in ASPNET2?

I'm running into a repeatable oddity in porting a bunch of ASPNET1.1 websites to ASPNET2. Calls like this:

MapPath("/path/fromroot")

result in exceptions under ASPNET2, but worked fine under ASPNET1.1.

Changing the calls to:

MapPath("~/path/fromroot")

makes them work again under ASPNET2.

Is this a design change? Or perhaps an artifact of using the "bundled" webserver in VS2005? I used to debug on a test server that
was separate from my development machine. Now, under VS2005, I do everything on the development machine.

- Mark
Feb 25 '06 #1
5 1341
Hi Mark,

Thanks for posting.

AS for the Server.MapPath function, I think the code logic of it should not
have been changed from ASP.NET 1.1 to 2.0. What's the detailed exception
message you get when call the Mappath function with the "/path/fromroot"
value or is this a machine or application specific issue?

As for "/path/fromroot" and "~/path/fromroot", they're two definite
different path. The former path start from the IIS web site's root while
the latter start from the ASPNET application's application root. Therefore,
it may result different results. Is it possible that some other code logic
in the application which use the Mappath's result cause the problem?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 27 '06 #2
Steven,

I posted elsewhere that the problem is in the way the silly testing server embedded in VS2005 handles websites. It runs all sites in
what amounts to a virtual directory of the server, for example:

Website destined to be the site for www.scef.us

Runs under embedded development server as http://local:1114/scef

See the problem? It should be running as http://local:1114, not http://local:1114/scef.

This is a big problem for anyone developing "root" websites under VS2005.

- Mark
Feb 27 '06 #3
Thanks for your response Mark,

As for the VS buildin test server, it is actually provided by the .NET
framework 2.0 in the framework dir

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

named "WebDev.WebServer.EXE". And as you mentioned, vs 2005 ide do by
default treat each ASP.NET website project as a sub virtual dir under the
root site when running them in test server. Like:

http://localhost:xxxx/ApplicationName/xxx

However, the VS 2005 ide also allow us to use the customized external test
server. You can right click your website's node in solution explorer and
choose properties menu. In the "Start options" setting, it is "use default
web server" by default, we can change it to "use custom server". For the
"Base Url", we can input the custom server's configured url we want to use,
such as
"http://localhost:7001/"

For the custom server, we can just use the WebDev.WebServer.EXE which can
be launched externally from command line. For example, the following
command just start the Test Server which point to my vs 2005 ASP.NET
website project's project folder and configure it as Root applcation(rather
than a sub virtual directly under root):

webdev.webserver /port:8088
/path:"D:\users\stcheng\workspace\whidbey\websites\ TestWebSite" /vpath:"/"

this will match the custom server's "Base Url" we configured in the ASP.NET
project above.

In addition, here is a blog article from ScottGu which have more detailed
description on this:

http://weblogs.asp.net/scottgu/archi...21/431138.aspx

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Feb 28 '06 #4
Steven,

It does help, but (and this is certainly not your issue) I think it's pretty dumb of MS to have released something that has such a
gotcha in it.

- Mark
Feb 28 '06 #5
Thanks for response.

Yes, currently it would be a limitation of the VS 2005 ide which will make
our work a bit more complex.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 1 '06 #6

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...
1
by: amber | last post by:
Hi there, I'd like to change the colour of my tabs. I can change my background colour of my tab control, but the actual tabs, with the text on them don't change colour. Am I missing something?...
1
by: ucasesoftware | last post by:
How is it possible to change the mdi parent backcolor... this one is too dark !!
5
by: Mark Olbert | last post by:
I'm starting to play around with VS2005 and ASP.NET 2 and have some questions. The typical pattern for a data-driven aspx page in v1.1 was data connection -> data adapter -> dataset -> bound...
8
by: Mark Olbert | last post by:
There appears to be a REALLY annoying bug in VS2005: periodically when you're rebuilding an ASPNET2 website which uses App_Code stuff the compiler will fail to create the dynamic assembly or not be...
8
by: Maxi | last post by:
Hello, i'm sorry my bad english :( I have CR9 Webservice, how to change databadse name and User_name into Webservice method? (not Viewer Control) Tks!! -- --------------------------
4
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
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: webandwe | last post by:
Hi, Can somebody please show me how to change the connection so I can make it work with my MYSQL database... I just need this login to work then I'm done wiht my project. I don't know what is...
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: 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: 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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.