creating user using post method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Parul Vinod
    New Member
    • Aug 2011
    • 36

    creating user using post method

    I want to create user in register form with the help of a program of post method. I have written the following code for it:
    Code:
    string post_data="parul0";
    string uri="http://localhost:1161/Register.aspx";
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
    request.KeepAlive = false;
    request.ProtocolVersion = HttpVersion.Version10;
    request.Method = "POST";
    byte[] postBytes = Encoding.ASCII.GetBytes(post_data);
    request.ContentType = "application/x-www-form-urlencoded";
    request.ContentLength = postBytes.Length;
    Stream requestStream = request.GetRequestStream();
    requestStream.Write(postBytes, 0, postBytes.Length);
    requestStream.Close();
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadToEnd());
    Console.WriteLine(response.StatusCode);
    New user is not getting created by this code.
    In registration page, new user is created.
Working...