Skip to content

Instantly share code, notes, and snippets.

@paigecook
paigecook / DidNotWork.xml
Created March 18, 2011 15:24
Settings that worked when MvcBuildViews is set to true.
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
@paigecook
paigecook / UrlExists.cs
Created January 31, 2011 15:09
Check if a Url exists
public static bool UrlExists(string url)
{
try
{
var request = WebRequest.Create(url) as HttpWebRequest;
if (request == null) return false;
request.Method = "HEAD";
using (var response = (HttpWebResponse)request.GetResponse())
{
return response.StatusCode == HttpStatusCode.OK;