MVC3 Getting the URI in a controller

If there is a need to get the URI that the was used to reach the controller then the Request holds that information and it can be retrieved to a URI object

public ActionResult MyAction()
{
    var uri = Request.Url;
    var port = uri.Port;
    var absoluteUri = uri.AbsoluteUri
 
    //... do things here
 
    return View();    
}

IIS/ASP.NET turning (browser) debug messages off

To make this change for one project at a time:

In  “Web.config”find the line saying “compilation debug=true” and switch this to false.

To make this change for the entire server:

In “%SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\Machine.config” find the line saying “compilation debug=true” and switch this to false.

More info on this from Microsoft:http://support.microsoft.com/kb/815157