The WebUtil Class in Sitecore

by aboo bolaky 30. November 2008 06:36

For those Sitecore lovers..

When you code against Sitecore, whether against renderings or sublayouts, I'd suggest you have a look at the very useful methods defined in Sitecore.Web.WebUtil Class. Those methods will help save you some time and prevent you from re-inventing the wheel. Some methods worth mentioning are :-

string AddQueryString(string url, params string[] parameters)
string AddQueryString(string url, bool xhtml, params string[] parameters)
string ExecuteWebPage(string url)
string ExtractFilePath(string url)
string ExtractUrlParm(string name, string url)
Placeholder FindPlaceholder(string key, Control root)
HtmlAnchor GetAnchor(Item itm, string linkField)
Control GetErrorControl(string error, string details)
Control GetFormControl(Page page)
string GetFormValue(string fieldName)
string GetFullUrl(string url, string serverUrl)
string GetHostIPAddress()
string GetHostName()
string GetQueryString()
string GetQueryStringOrCookie(string key, string defaultValue)
void RedirectToErrorPage(string text)
string RemoveQueryString(string url)
void ReloadPage()
string ReplaceUrlParameter(string url, string replace, string withtext, bool append)

Alternatively, you can have a peek at all the methods in the screen grab below [Click on the image for a better view..]

Tags:

.Net | Applications | Sitecore | Tips & Tricks

Tag cloud

Flash Player 9 required.

About Me

I wish I could write something here..
//TODO: ElaborateMe