Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > small doubt regarding ResolveURL

Reply
Thread Tools

small doubt regarding ResolveURL

 
 
SandyIsCool
Guest
Posts: n/a
 
      12-15-2006
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

 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      12-15-2006
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" <> wrote in message
news: 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
>



 
Reply With Quote
 
 
 
 
SandyIsCool
Guest
Posts: n/a
 
      12-15-2006
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" <> wrote in message
> news: 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
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ResolveUrl in a static helper method Lloyd Dupont ASP .Net 5 10-31-2007 10:37 AM
ResolveUrl vs ~ bryanp10@hotmail.com ASP .Net 3 06-24-2007 03:41 AM
Difference between Server.mappath and Page.resolveURL SandyIsCool ASP .Net 4 12-15-2006 01:59 PM
alternative to ResolveUrl() Lloyd Dupont ASP .Net 0 01-29-2006 08:24 AM
More woes ResolveUrl Lloyd Sheen ASP .Net 1 01-26-2004 05:39 AM



Advertisments