473,624 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

small doubt regarding ResolveURL

Hi

I used the below code for an image button
image1.imageurl ="~/images/image1.jpg";
image1.imageurl =Page.ResolveUr l("~/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
2 2315
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.ResolveUr l("~/images/image1.jpg");
will return "/Foo/images/image1.jpg"

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

image1.imageurl =Page.ResolveUr l("~/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/
=============== =============== =====
"SandyIsCoo l" <sa************ *@gmail.comwrot e in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi

I used the below code for an image button
image1.imageurl ="~/images/image1.jpg";
image1.imageurl =Page.ResolveUr l("~/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
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.ResolveUr l("~/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.ResolveUr l("~/images/image1.jpg");
will return "/Foo/images/image1.jpg"

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

image1.imageurl =Page.ResolveUr l("~/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/
=============== =============== =====
"SandyIsCoo l" <sa************ *@gmail.comwrot e in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi

I used the below code for an image button
image1.imageurl ="~/images/image1.jpg";
image1.imageurl =Page.ResolveUr l("~/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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1162
by: Lloyd Sheen | last post by:
I have a weird (at least to those who think the IDE should work) problem. I have in code the following: psFiles = Page.ResolveUrl("/Pictures") This resolves to /Pictures in the code In command window enter the following: ?Page.ResolveUrl("/Pictures") This resolves to G:/MyPictures"
4
4505
by: Lloyd Dupont | last post by:
When I want some app resources I usually write something like: MapPath(ResolveUrl("~/App_Data/MyResource")) How could I do the same thing in a static helper method? I mean MapPath & ResolveUrl are instance method of Page, so a static method can't use them... -- I have taken a vow of poverty. If you want to really piss me off, send me money.
0
1285
by: Lloyd Dupont | last post by:
I'm writing an web element (in fact a ToolbarButtopn for FreeTextBox), which is not a subclass of SWU.Control. I need to know the client path for something like: "~/utils/Gallery.aspx" In Control I could simple use ResolveUrl() which will convert "~/" to whatever appropriate, such as "/MyWebSite" or "/" But how do I do without ResolveUrl() ?
17
2526
by: Student | last post by:
Hi All, I have an assignment for my Programming language project to create a compiler that takes a C++ file as input and translate it into the C file. Here I have to take care of inheritance and operator overloading and virtual functions. I mean it should not hamper the C++ meaning. In frank and simple terms i need to implement a small C++ compiler in C++, and i want the intermediate representation to be C. Please help me in this....
4
14143
by: SandyIsCool | last post by:
Hi, Can any one let me know what is difference between Server.mappath and Page.resolveURL and what are the situations we use them. Thanks, Sandy
3
11351
by: bryanp10 | last post by:
Are there any advantages/disadvantages between these two approaches: <img src="~/images/nav_01.gif" runat="server"> vs. <img src="<%=ResolveUrl("~/images/nav_01.gif")%>"> Are they more or less the same thing? I've noticed that they render differently, but I can't think of a situation where they should behave
6
4612
by: tshad | last post by:
I am finally getting the path to the Current Page using Page.ResolveURL. I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what I was looking for. But what is the syntax to add it into the HyperLink object? I tried: <asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
1
7440
by: NightOwl888 | last post by:
I have an older web project that I am trying to update with new .NET 2.0 features. I put new master pages in a subdirectory below the project directory. This particular project runs under IIS (rather than using a file location). So, the directory that my master pages are in looks like this: C:\inetpub\wwwroot\MyProject\MasterPages\
2
5151
by: Max2006 | last post by:
Hi, Is it possible to have the functionality of ResolveURL within *.ashx files? Thank you,
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.