What are the rules for using \ or /

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

What are the rules for using \ or /

In a .vb file it appears I can intermix them. They appear to be equal.

Is that true.

What do you use in .vb files?



But in an .aspx file I'm not sure.

I bombed once using FireFox, changed \ to / and then it ran OK.

Not sure if that was what caused the problem.

What do you use in .aspx files?



Are there rules I can follow to stay out of trouble?





Thanks
 
You use \ for hard drive paths and / for virtual paths.



Juan T. Llibre, asp.net MVP
¿ Estas probando VS 2010 y ASP.NET 4.0 ?
Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
http://asp.net.do/foros/forums/
=====================================================
 
What are the rules for using \ or /

In a .vb file it appears I can intermix them. They appear to be equal.

Is that true.

What do you use in .vb files?


\ is a DOS path, inlcluding UNC
/ is a virtual path, which is used in URLs and other 'net paths

BTW, just because VB fixes things for you does not mean you should be
sloppy. ;-)

Examples:

c:\mypath\mydoc.txt - file path

file://c:\mypath\mydoc.txt - file path qualified to distinguish from
other virtual paths

http://www.mywebsite.com/file.txt - web path

etc.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Gregory said:
\ is a DOS path, inlcluding UNC
/ is a virtual path, which is used in URLs and other 'net paths

BTW, just because VB fixes things for you does not mean you should be
sloppy. ;-)
That why I'm asking.

thanks
 
<%@ Page Language="VB" MasterPageFile="~/Main.master"

<%@ WebService Language="VB" CodeBehind="~/App_Code/WebServiceGetSlides.vb"

<img src="../Albums/HttpHandlerSendImageD...



I can figure it out if it starts with ,say, C:/

or http"//

but the above appear to be file paths.

Are they correct?





Thanks
 
re:
!> the above appear to be file paths

They are virtual paths...

~/ identifies the virtual root directory of an ASP.NET web application.

<img src=... always refers to virtual paths on the server.
If <img src referred to a physical path, the image would have to reside in the user's hard drive.




Juan T. Llibre, asp.net MVP
¿ Estas probando VS 2010 y ASP.NET 4.0 ?
Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
http://asp.net.do/foros/forums/
=====================================================
 
Back
Top