Please help::Not able to Login using WebRequest/WebResponse

Discussion in 'ASP .Net' started by Guest, Jun 14, 2006.

  1. Guest

    Guest Guest

    I am using the code below to login to a password requiring website
    programatically. I keep getting back the logon page. I have read some posts
    here and haven't found a working solution still. I don't need any proxy to
    connect. After seeing some posts I eeven added a cookie container, still
    doesn't work.I'd really appreciate a lot, if someone could tell me what
    additional code is required to make this work
    Thanks in advance,
    // Prepare web request...
    HttpWebRequest myRequest =
    myRequest.Method = "POST";
    myRequest.CookieContainer = new CookieContainer(); // enable cookies

    NetworkCredential networkCredential = new NetworkCredential(strName,
    // Associate the 'NetworkCredential' object with the 'WebRequest'
    myRequest.Credentials = networkCredential;

    //System.Net.WebResponse myWebResponse = myRequest.GetResponse();
    HttpWebResponse myWebResponse =
    StreamReader sr = new
    StreamReader(myWebResponse.GetResponseStream(), Encoding.ASCII);
    txtResult.Text = sr.ReadToEnd();
    Guest, Jun 14, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.