Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MapPath relative path for IIS 6

Status
Not open for further replies.

Y22222

Technical User
Dec 4, 2003
15
0
0
US
Sorry for stupid question.

My new hosting company has db folder above (../) thingy doesn't work - IIS6 throws an invalid character error.

Is there any way to use Server.MapPath in this case or I have to hard-code an absolute path?
 
you will need to reference the entire path. It may look something like:

d:\html\users\<your domain>\html\<your custom directory
of course, this path will vary depending on the hosting company you are using. Use as just a guide.

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
Thank you Brian,
I already got it working this way.

I was just interested if there is another syntax for (../)
 
Oops, sorry about that, I'm not aware of the sytax for the (../) way.

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
You can't use a ../ in a Server.MapPath you can use a relative path ie - /something/whatever but that won't help in your case as your db folder is above the web root. I think the only way it's going to work for you is to provide the absolute path.
 
Thanks AdmanOK ,

The thing is that 2 or 3 of my different web hosting companies have the same BD folder location (above the root) and for some reason ../ in Server.MapPath works just fine athough it should not.


 
../ does work in Server.MapPath but with limitations on how it is preseved to other means of usage. it is only meant for use in getting the properties of the directories and not so much setting paths. if certain criteria in resources are not correct the &quot;..&quot; will cause a nasty error (exception) so it is usually highly recommended not to do so. and the good book has always stated

Remarks
The MapPath method does not support relative path syntax (.) or (..). For example, the following relative path, ../MyDir/MyFile.txt, returns an error.


more resources



_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top