By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,310 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,310 IT Pros & Developers. It's quick & easy.

small doubt regarding ResolveURL

P: n/a
Hi

I used the below code for an image button
image1.imageurl="~/images/image1.jpg";
image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
Both statements work fine..
I want to see a case where resolveURL method makes a difference.
Thanks,
Sandeep

Dec 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sandy,

ResolveUrl is very useful when you need to move applications from one server
to another, where the directory structure might be completely different.

If you have a server with a virtual application /Foo :

image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
will return "/Foo/images/image1.jpg"

If you have a server with a virtual application /Bar :

image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
will return "/Bar/images/image1.jpg"

Notice that the *same* code resolves different base URLs,
even though the *relative* URLs are identical.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"SandyIsCool" <sa*************@gmail.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Hi

I used the below code for an image button
image1.imageurl="~/images/image1.jpg";
image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
Both statements work fine..
I want to see a case where resolveURL method makes a difference.
Thanks,
Sandeep

Dec 15 '06 #2

P: n/a
Hi Juan,
thanks for the quick reponse.

But ("~/images/image1.jpg) still can be assigned to imageurl without
using resolving url function. As I said
image1.imageurl="~/images/image1.jpg";
image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");

both work fine. ~ also works without resolveURL function.

Thanks,
Sandeep

Juan T. Llibre wrote:
Sandy,

ResolveUrl is very useful when you need to move applications from one server
to another, where the directory structure might be completely different.

If you have a server with a virtual application /Foo :

image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
will return "/Foo/images/image1.jpg"

If you have a server with a virtual application /Bar :

image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
will return "/Bar/images/image1.jpg"

Notice that the *same* code resolves different base URLs,
even though the *relative* URLs are identical.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"SandyIsCool" <sa*************@gmail.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Hi

I used the below code for an image button
image1.imageurl="~/images/image1.jpg";
image1.imageurl=Page.ResolveUrl("~/images/image1.jpg");
Both statements work fine..
I want to see a case where resolveURL method makes a difference.
Thanks,
Sandeep
Dec 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.