.NETGURU
Server.MapPath()
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngfw' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Mats Cederholm
Hi, all, does anyone know why
Server.MapPath("http://www.mysite.net/SomeDirectory/SomeFile.aspx";)
returns the result:
C:\DirectoriesToInetPub\SomeDirectory\http:\www.mysite.net\SomeDirectory
\SomeFile.aspx?
Is this a bug or am I doing something wrong?

TIA, Mats

/*****************************************************************
Super soakers make great cat behavior-correction devices.
*****************************************************************/

Reply to this message...
 
    
Timo Pijnappel
the request may be to enter the physical Server Path.
You must enter the full path to your servers path (eg.
C:\inetpub\mysite\somedirectory\somefile.aspx)

----- Original Message -----
From: "Mats Cederholm" <Click here to reveal e-mail address>
To: "aspngfw" <Click here to reveal e-mail address>
Sent: Thursday, August 09, 2001 4:00 PM
Subject: [aspngfw] Server.MapPath()

[Original message clipped]

Reply to this message...
 
    
Walter Knopf (VIP)
The Server.MapPath doesn't like to have the protocal lumped in
with the address, it just likes an address in web site tree.
Just like in regular asp use:
Server.MapPath("/SomeDirectory/SomeFile.aspx")
assuming SomeDirectory is right below the web root.

Walter

-----Original Message-----
From: Mats Cederholm [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 09, 2001 9:01 AM
To: aspngfw
Subject: [aspngfw] Server.MapPath()

Hi, all, does anyone know why
Server.MapPath("http://www.mysite.net/SomeDirectory/SomeFile.aspx";)
returns the result:
C:\DirectoriesToInetPub\SomeDirectory\http:\www.mysite.net\SomeDirectory
\SomeFile.aspx?
Is this a bug or am I doing something wrong?

TIA, Mats

/*****************************************************************
Super soakers make great cat behavior-correction devices.
*****************************************************************/

| [aspngfw] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngfw.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Scott (VIP)
MapPath expects a relative path, not an absolute path. Try:

Server.MapPath("/SomeDirectory/SomeFile.aspx")

Scott Swigart

-----Original Message-----
From: Mats Cederholm [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, August 09, 2001 7:01 AM
To: aspngfw
Subject: [aspngfw] Server.MapPath()

Hi, all, does anyone know why
Server.MapPath("http://www.mysite.net/SomeDirectory/SomeFile.aspx";)
returns the result:
C:\DirectoriesToInetPub\SomeDirectory\http:\www.mysite.net\SomeDirectory
\SomeFile.aspx?
Is this a bug or am I doing something wrong?

TIA, Mats

/*****************************************************************
Super soakers make great cat behavior-correction devices.=20
*****************************************************************/

| [aspngfw] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.asplists.com/asplists/aspngfw.asp =3D JOIN/QUIT=20
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Dave Foderick
Follow up question:
Is there any option to have it return the slash (/) by default instead of
the backslash (\) (so I don't have to run it through the replace function)?

Dave
Click here to reveal e-mail address
www.southbeachsoftware.com

-----Original Message-----
From: Scott [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 09, 2001 5:23 PM
To: aspngfw
Subject: [aspngfw] RE: Server.MapPath()

MapPath expects a relative path, not an absolute path. Try:

Server.MapPath("/SomeDirectory/SomeFile.aspx")

Scott Swigart

-----Original Message-----
From: Mats Cederholm [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 09, 2001 7:01 AM
To: aspngfw
Subject: [aspngfw] Server.MapPath()

Hi, all, does anyone know why
Server.MapPath("http://www.mysite.net/SomeDirectory/SomeFile.aspx";)
returns the result:
C:\DirectoriesToInetPub\SomeDirectory\http:\www.mysite.net\SomeDirectory
\SomeFile.aspx?
Is this a bug or am I doing something wrong?

TIA, Mats

/*****************************************************************
Super soakers make great cat behavior-correction devices.
*****************************************************************/

| [aspngfw] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngfw.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngfw] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngfw.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com

Reply to this message...
 
    
Steven A Smith (VIP)
No.

----- Original Message -----
From: "Dave Foderick" <Click here to reveal e-mail address>
To: "aspngfw" <Click here to reveal e-mail address>
Sent: Thursday, August 09, 2001 4:09 PM
Subject: [aspngfw] RE: Server.MapPath()

[Original message clipped]

Reply to this message...
 
    
Mats Cederholm
Yes, of course, I don't know what I was thinking :)

/Mats

/*****************************************************************
What does a dyslectic, agnostic insomniac do?
He lies awake most of the night wondering if there is a dog.=20
*****************************************************************/

[Original message clipped]

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification