Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 22, 2011 10:10 PM by gww
Aug 19, 2011 08:39 AM|LINK
Below is the code to chek if a url is valid or not
HttpWebRequest request =
request.PreAuthenticate = true;
request.Method = "HEAD";
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = request.GetResponse()
return (response.StatusCode ==
The problem is in "DefaultCredentials" which is empty.
google results did not give a effective solution.
Here is what i am trying
1. My System is connected to active directory
2. Enter username, password and domain to login in the system
3. Create a new website using vs2008
4. Create a page which contains a textbox which accepts the Url.
5. i am passing the url to the above function.
6. added impersonate in the web.config and directory property also
7. It returns an exception
but the same url if i paste in a browser -> it asks for username
and password. i am able to see the page
I have googled but the solution is not understandable or no answers for this question. Could any one help with a simple solution.
Aug 22, 2011 10:10 PM|LINK
What is the full text of the exception you get?
I would start by doing a response.write of the url being passed to the function and see what it looks like. You may need to url encode the url.