asp.net.ph

Control.ResolveUrl Method

System.Web.UI Namespace   Control Class


Resolves a relative URL to an absolute URL based on the value passed to the TemplateSourceDirectory property.

 [ VB ]
Public Function ResolveUrl ( _
   ByVal relativeUrl As String _
) As String

 [ C# ]
public string ResolveUrl (
   string relativeUrl
);

 [ C++ ]
public: String* ResolveUrl (
   String* relativeUrl
);

 [ JScript ]
public function ResolveUrl (
   relativeUrl : String
) : String;

Parameters

relativeUrl
The relative URL associated with the TemplateSourceDirectory property.

Return Value

The absolute URL.

Exceptions


Exception Type Condition
ArgumentException Thrown if the relativeUrl parameter is a null reference ( Nothing in Visual Basic ).

Remarks

This method uses the TemplateSourceDirectory property to resolve to the absolute URL. The returned URL is for client use, and contains the session cookie if appropriate.

Example

The following example demonstrates using the ResolveUrl method.

public class myResolveUrl:Control {
   private string _ImageUrl;
   public string ImageUrl {
      get {
         return _ImageUrl;
      }
      set {
         _ImageUrl = value;
      }
   }

   protected override void Render ( HtmlTextWriter output ) {           
      Image myImage = new Image ( );
      // Resolve Url.
      myImage.ImageUrl = ResolveUrl ( this.ImageUrl );
      myImage.RenderControl ( output );
   }     
}
  C# VB

See Also

Control Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph