<p>In my asp.net mvc app I want to check if a certain url returns a valid response.
Therefor I send the url to a method that tests the HttpWebRequest.GetResponse()</p>

<p>On my dev server (vs2008) it works just fine.
When deployed on production server however, it returns a Bad Request.
The method is never hit and my asp.net custom error pages are not used.</p>

<p>any ideas?</p>

Perhaps you are running into the
ValidateRequest
feature of ASP.NET? You can disable this for the page in question by modifying the first line in the aspx file to have the ValidateRequest="false" parameter.
Example:
```
```
<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" ValidateRequest="false" %>
```
```
You probably don't want to leave it in that state though, as the request validation helps prevent XSS attacks. Using HttpUtility.UrlEncode may also be worth trying, if you aren't already.