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

Discussion in 'ASP .Net' started by =?Utf-8?B?TmFnYQ==?=, Jun 14, 2006.

  1. 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,
    Naga
    -*****************************************************
    // Prepare web request...
    HttpWebRequest myRequest =
    (HttpWebRequest)WebRequest.Create(txtUrl.Text.Trim());
    myRequest.Method = "POST";
    myRequest.CookieContainer = new CookieContainer(); // enable cookies

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

    //System.Net.WebResponse myWebResponse = myRequest.GetResponse();
    HttpWebResponse myWebResponse =
    (HttpWebResponse)myRequest.GetResponse();
    StreamReader sr = new
    StreamReader(myWebResponse.GetResponseStream(), Encoding.ASCII);
    txtResult.Text = sr.ReadToEnd();
    -*****************************************************
    =?Utf-8?B?TmFnYQ==?=, Jun 14, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    1
    Views:
    788
    Joerg Jooss
    Mar 5, 2005
  2. Savas Ates

    WEBREQUEST AND WEBRESPONSE PROBLEM

    Savas Ates, Jan 24, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    860
    Savas Ates
    Jan 24, 2006
  3. Dan Sikorsky

    HOWTO: Print HTML page using WebResponse

    Dan Sikorsky, Feb 22, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    569
    Dan Sikorsky
    Feb 22, 2006
  4. George Ter-Saakov

    WebRequest/WebResponse gotcha

    George Ter-Saakov, Mar 7, 2008, in forum: ASP .Net
    Replies:
    7
    Views:
    2,354
    John Saunders [MVP]
    Mar 10, 2008
  5. sed_y
    Replies:
    0
    Views:
    996
    sed_y
    Feb 15, 2012
Loading...

Share This Page