ResolveUrl vs. ResolveClientUrl

by Peter Tyrrell Thursday, June 28, 2007 1:30 PM

The .NET Control class methods ResolveUrl and ResolveClientUrl both take a relative URL as a parameter and return relative URLs for client browser use. So what's the difference between them?

In simple terms, ResolveClientUrl returns a path relative to the current page, and ResolveUrl returns a path relative to the site root. Both methods are particularly useful when passing in a relative URL prefaced with the tilde (~) to indicate the application root.

Let's say we have an image in a layout directory, and a page which needs to pass a usable relative URL for the image to the client browser.



Here is what we would get if we called the two methods from our Default.aspx page.


There is more to it, of course, particularly since these are Control methods, not exclusively Page methods. It's pretty straightforward to see how paths relative to a page resolve, but not necessarily so obvious when the control is being instantiated in a UserControl or MasterPage.

ResolveUrl uses the Control.TemplateSourceDirectory property to do its job, and that property value is the virtual directory of the Page or UserControl that contains the current server control.

ResolveClientUrl returns a URL relative to the folder containing the source file in which the control is instantiated.

Tags: ASP.NET | tips

Public Hotfix Patch Available for Debugging ASP.NET on IIS7

by Administrator Thursday, June 28, 2007 10:36 AM

Mentioned first a couple posts back, there is now a public hotfix patch available for debugging ASP.NET on IIS7 that you can download here. The reason for this post is that Scott Guthrie just wrote a post that gives a much better explanation of the problem and fix.

Type-safe access to the current page's URL

by Ted Jardine Wednesday, June 27, 2007 5:46 PM

Virtually every web project you work on requires that you get the current page's complete URL. Years ago, I got tired of using non-type-safe ways of munging together various Request.ServerVariables to get it (anyone remember stuff like "If Request.ServerVariables("HTTPS") = "on" Then..."?) and with .NET there had to be a better way. Due to a dearth of non-Request.ServerVariables examples out there back then, it took trusty trial and error Response.Write tests and the MSDN help to settle on the following:

Request.Url.Scheme + Request.Url.SchemeDelimiter + Request.Url.Authority + Request.Url.PathAndQuery

While I never understood why I still had to parse these together (and I sporadically investigated alternatives), it nevertheless felt so much better than parsing together strings like "://" with icky stuff like Request.ServerVariables("SERVER_NAME").

But yes, there had to be an even better way: a way that resisted forgetfulness and the ensuing battle with more than vague intellisense descriptions. Since I'm slow, it was only today that I found it. My my, sometimes I do miss the obvious:

returns the canonically unescaped form of the URI (i.e. " and thin.htm")


Returns the canonically escaped form of the URI (i.e.

And yes, I had tried out AbsoluteUri before (I must have, right?), but for some reason, I still missed it.

Tags: ASP.NET | tips

WebClarity releases BookWhere version 6

by Administrator Tuesday, June 26, 2007 3:01 PM
Customers with ongoing maintenance subscriptions may download this new version for no additional charge. Check out the new features or register for one of the WebClarity product overview webinars.

BookWhere is a great tool for the ongoing cataloguing of new library material as well as retrospective conversion projects. Hundreds of library databases worldwide can be searched and their bibliographic records exported in MARC communications format. These records can then be converted using the MARC Transformer add-on product and imported into Inmagic Genie or other Inmagic textbases.

Contact Andornot for more information and pricing.

Tags: News | BookWhere

Inmagic news releases regarding Presto software

by Administrator Tuesday, June 26, 2007 2:43 PM
Inmagic, Inc. has recently issued news releases on two Presto customers.

May 31, 2007 - Inmagic Presto Software Ensures NASA Space Shuttle Safety by Organizing and Providing Access to Critical Images
Read the press release

June 26, 2007 - R.V. Anderson Associates Limited Selects Inmagic Presto to Capture and Share Its Intellectual Capital
Read the press release

Inmagic® Presto is a Web-based enterprise application designed for organizations where managing multiple collections of information in diverse formats and locations is of strategic importance. Information-intensive organizations that use Presto typically have high-value and dynamic content that needs to be centrally managed and made available 24/7 for efficient research by a wide audience.

Please contact Andornot for further information on Presto or other Inmagic products.

Tags: News

Month List