Aboo Bolaky

{.NET, C#, Sitecore ...} Free your mind...

The WebUtil Class in Sitecore

clock November 29, 2008 21:36 by author Aboo Bolaky

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 :-

[code=csharp; Some useful Utility methods ]

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)

[/code]

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

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Comments

16. July 2009 17:09

Online Loan

Wow your post very popular nice i can be here for read. Keep Post bro...I will visit back later hope you will have a new post Thx.

Online Loan

17. July 2009 13:05

SEO Secrets

Glad to visit your blog. Thanks for great post that you share to us...

SEO Secrets

17. July 2009 13:05

SEO Secrets

Glad to visit your blog. Thanks for great post that you share to us...

SEO Secrets

18. July 2009 13:48

Lån

Great writeup.. I guess you summed it all up.. Cheers

Lån

18. July 2009 13:48

Lån Online

Nice way of summing it up.. cheers

Lån Online

8. October 2009 15:48

zaklady bukmacherskie

Very informative site, i must bookmark it, keep posting interesting articles...

zaklady bukmacherskie

Add comment


(Will show your Gravatar )  

  Country flag

biuquote
  • Comment
  • Preview
Loading



A b o u t M e

Annoying

Brilliant

Open and

Objective

in every way..
Only Human >>
 
"First learn computer science and all the theory.

Next develop a programming style.

Then forget all that and just hack." Carrette (1990)