Reputation: 299
Im using my asp.net code behind to register some startup script.
The following code gets rendered to the browser.
var rotator = new ImageRotator('rotateImg');
rotator.AddImage('DisplayThumbnailImage.aspx?FilePath=C:\Development\Projects\TouchSA\Trunk\WebSite\Gallery\photo_4.PNG&ThumbnailWidth=535&ThumbnailHeight=316');
rotator.Rotate();
This looks right...but when the AddImage method receives the parameter, all the backslashes are gone. Why?
Upvotes: 0
Views: 154
Reputation:
Encode your URL and you'll have no problems.
Server.UrlEncode()
To decode
Server.UrlDecode()
Upvotes: 2
Reputation: 2479
Answering your question without giving any remarks to the local url. ;)
To get an "\" you have to escape it... Like this
'DisplayThumbnailImage.aspx?FilePath=C:\\Development\\Projects\\TouchSA\\Trunk\\WebSite\\Gallery\\photo_4.PNG&ThumbnailWidth=535&ThumbnailHeight=316'
Upvotes: 4
Reputation: 147471
I suspect you simply need to escape the backslashes. i.e. Use \\
instead of \
in your string.
var rotator = new ImageRotator('rotateImg');
rotator.AddImage('DisplayThumbnailImage.aspx?FilePath=C:\\Development\\Projects\\TouchSA\\Trunk\\WebSite\\Gallery\\photo_4.PNG&ThumbnailWidth=535&ThumbnailHeight=316');
rotator.Rotate();
Upvotes: 0