Assuming you have a Request object available, you can use:
string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));
If it’s not available, you can get to it via the context:
var request = HttpContext.Current.Request
More Related Contents:
- New asp.net charting controls – will they work with MVC (eventually)?
- ASP.NET MVC – Getting QueryString values
- MVC4 HTTP Error 403.14 – Forbidden
- Postback doesn’t work with aspx page as Default Document
- GZip Compression On IIS 7.5 is not working
- How to create a CheckBoxListFor extension method in ASP.NET MVC?
- Using scripts in a master page with ASP.NET MVC
- How do I improve ASP.NET MVC application performance?
- How to send an email with attachments using SmtpClient.SendAsync?
- ASP.Net MVC Redirect To A Different View
- ASP.NET strange compilation error
- How do I solve an AntiForgeryToken exception that occurs after an iisreset in my ASP.Net MVC app?
- Integrate existing ASP.NET MVC application with Orchard CMS
- Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction
- How to solve “Could not establish trust relationship for the SSL/TLS secure channel with authority”
- Windows update caused MVC3 and MVC4 stop working
- Visual Studio – Resx File default ‘internal’ to ‘public’
- ASP.NET MVC – How to show unauthorized error on login page?
- System.Runtime.InteropServices.COMException (0x800A03EC)
- ServiceRoute + WebServiceHostFactory kills WSDL generation? How to create extensionless WCF service with ?wsdl
- Where and how is the _ViewStart.cshtml layout file linked?
- .NET MVC Call method on different controller
- ASP.NET MVC 3 Model Binding Resources
- FileUpload control inside an UpdatePanel without refreshing the whole page?
- double escape sequence inside a url : The request filtering module is configured to deny a request that contains a double escape sequence
- The model item passed into the dictionary is of type ‘mvc.Models.ModelA’ but this dictionary requires a model item of type ‘mvc.Models.ModelB‘
- Can I use ASP.NET MVC together with regular ASP.NET Web forms
- How do I sync the SVN revision number with my ASP.NET web site?
- The model backing the ‘ApplicationDbContext’ context has changed since the database was created
- Why are there two incompatible session state types in ASP.NET?