SharePoint Get Current Web URL

How to get SharePoint site current URL ?

We can get SharePoint Current web url in Server-Side as well as in Client side.

Server Side:

 As we all know current web url can be accessed in server side by web object as below.


Client Side:

In client side , we can achieve this by using SPServices .

Here is how to achieve this:
Include SPServices js file in your page.
Now you can access the url this way:
var thisWebUrl = $().SPServices.SPGetCurrentSite();
But there is a bug in recent versions of SPServices , where the above method will return only "/".
But in SharePoint 2013, we  can access web url as below as well :
var thisWebUrl = _spPageContextInfo.webAbsoluteUrl; (web url)
var thisSiteUrl = _spPageContextInfo.siteAbsoluteUrl; (site url)
Enjoy coding :)