You don't use a Unit Test to do that ?? don't you ?
You can automatically submit a page to the W3C XHTML either as a URL or as rendered HTML nut they do require to submit no more than one request per second.
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Marked as answer by sunnyshiny06 on Mar 11, 2010 09:43 AM
sunnyshiny06
Member
69 Points
122 Posts
Test URL Validity - by UnitTest Visual Studio 2008Pro
Mar 02, 2010 09:46 AM|LINK
Hi,
I would like to test the URL validity of my website by UnitTest.
What would you advice me ?
Thanks a lot,
icecape67
Member
538 Points
99 Posts
Re: Test URL Validity - by UnitTest Visual Studio 2008Pro
Mar 02, 2010 11:11 AM|LINK
you can do a http post to the W3 validator service:
HttpWebResponse response = null; StreamReader reader = null; Stream dataStream = null; try { var request = WebRequest.Create( string.Format( "http://validator.w3.org/check?uri={0}&charset=%28detect+automatically%29&doctype=Inline&group=0", System.Web.HttpUtility.UrlEncode("http://www.urltovalidate.com") ) ); response = (HttpWebResponse)request.GetResponse(); dataStream = response.GetResponseStream(); reader = new StreamReader(dataStream); this.StatusCode = response.StatusCode; var responseContent = reader.ReadToEnd(); var validationRegex = new Regex("This document was successfully checked as XHTML 1.0 Transitional!"); return validationRegex.Match(responseContent).Success; } finally { reader.Close(); dataStream.Close(); response.Close(); }sunnyshiny06
Member
69 Points
122 Posts
Re: Test URL Validity - by UnitTest Visual Studio 2008Pro
Mar 02, 2010 11:41 AM|LINK
You don't use a Unit Test to do that ?? don't you ?
icecape67
Member
538 Points
99 Posts
Re: Test URL Validity - by UnitTest Visual Studio 2008Pro
Mar 03, 2010 12:13 PM|LINK
you can do
TATWORTH
All-Star
72415 Points
14017 Posts
MVP
Re: Test URL Validity - by UnitTest Visual Studio 2008Pro
Mar 06, 2010 07:39 PM|LINK
You can automatically submit a page to the W3C XHTML either as a URL or as rendered HTML nut they do require to submit no more than one request per second.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239