Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, August 13, 2010 1:22 PM
Note: My question is particularly for WebPages/Razor/WebMatrix.
Why the Web Pages tutorials is "encouraging" (indirectly) using "\ (backslash) instead of "/" (forward-slash) while using relative paths?
Take this code for example?
@{ var imagePath= ``""``;
``WebImage photo = ``new WebImage(``@"~\Images\Photo3.jpg"``);
``if``(photo != ``null``){
``imagePath = @"images\Photo3.jpg"``;
``photo.AddTextWatermark(``"My Watermark"``, fontColor:``"Yellow"``, fontFamily:
``"Arial"``);
``photo.Save(@"~\" + imagePath); }
}
Is there a particular reason?
Note:
1: <img src="images**\Photo3**.jpg" /> will display fine in IE but not in FF.
2: <img src="images**/Photo3**.jpg" /> displays fine in IE and FF.
All replies (3)
Friday, August 13, 2010 3:01 PM âś…Answered
You're correct, it should be using forward slashes for virtual paths. I'll track down the right person to fix this.
thanks,
David
Friday, August 13, 2010 2:25 PM
Use a backslash (\ to separate the components of a path. The backslash divides the file name from the path to it, and one directory name from another directory name in a path. You cannot use a backslash in the name for the actual file or directory because it is a reserved character that separates the names into components.
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
Friday, August 13, 2010 4:37 PM
Thanks for the link but I was particulary talking about issues with Web Pages tutorials.
David,
Thanks...you got me right.