In these small code snippet you can check server response. In last few week my friends mostly time spend check URl is correct or correct response give or not. we make a small application check _Url automatically one by one.
- public bool test(string _Url)
- { Bool condition=true;
- WebRequest webRequest = WebRequest.Create(_Url);
- WebResponse webResponse;
- try
- {
- webResponse = webRequest.GetResponse();
- if ("/error" == webResponse.ResponseUri.AbsolutePath)
- {
- condition=false;
- }
- }
- catch
- {
- condition=false
- }
- return condition;
- }
Final word
I know above code is not very difficult but if any confusion create in mind drop your comments in below comment Dropbox.