PLEASE HELP : usnig webresponse

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amine

    #1

    PLEASE HELP : usnig webresponse

    I really need help on this please. I am writing an
    application for an Ipaq and I am trying to enable the
    application to connect to a DAV server which can is
    basically an HTTP server that acts like an FTP server. I
    used the following code

    WebRequest req = WebRequest.Crea te (url);
    req.Credentials = new NetworkCredenti al (username, pass);
    WebResponse res = req.GetResponse ();

    the previous code caused the server to display the 401
    error :Unauthorized (WebException).

    So I thought maybe there is a proxy in the way so I used
    the following code

    WebRequest req = WebRequest.Crea te (url);
    WebProxy curr_proxy = new WebProxy (url, true);
    curr_proxy.Cred entials = new NetworkCredenti al (username,
    pass);
    page_req.Proxy = curr_proxy;
    WebResponse res = req.GetResponse ();

    that caused the same exact problem
    I know for sure that the username and password are correct
    cuz I can connect to that site through the browser (When
    trying to access the site it prompts me for username and
    password just as an HTTP server would.) and I know the
    code works for other sites cuz I tried. (I didnt try an
    password protected site though)

    Oh ya and I also tried HttpWebRequest and HttpWebResponse
    same problem

    PLEASSE HELP. this is my senior thesis and I am basically
    screwed if I dont figure this out soon

    THANK YOU
Working...