0
url = @"http://website"; 
WebRequest request = WebRequest.Create(url); 
request.Credentials = CredentialCache.DefaultCredentials; 
//request.Credentials = new System.Net.NetworkCredential("id", "pw","domain"); 
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
 it works well in c# WindowsFormsApplication 
 but get 404 response in ConsoleApplication 
 ( web.config of website  )

Does any one know how to solve it?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Oct 16 '13 at 04:23
  • What are credentials in console application? Are they same as in web application? – Piotr Stapp Oct 16 '13 at 04:28
  • Do you have the same configuration in the app.config that you have in the web.config? – codemonkeh Oct 16 '13 at 05:35
  • 1
    404 is a status returned by a website indicating the resource could not be found - are you _absolutely sure_ the `url` is equal in both cases? Try use fiddler or another tool to diagnose the network traffic. – C.Evenhuis Oct 16 '13 at 06:53

0 Answers0