I have a website in sp 2010, in which I need to add a Home button on one of the webpages, which can redirect to home page . The requirement is that, i cannot use hardcoded URL for the home page. I have tried using linkbuton using postback url property but cant get it right. Please provide me suggestions or solution.
var baseUrl = location.protocol +'//'+ document.location.hostname
var baseUrl = location.origin
e.g.: if your current url is http://server1/sites/test1/Lists the commands above will give you http://server1
I solved the issue by using the below code on button click
'string URL = SPContext.Current.Web.Url;