How To Use ASP.NET and HTTPrequest POST method

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserCheck.aspx.cs" Inherits="UserCheck" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
   <title>Untitled Page</title>

  <script type = "text/javascript">
  function validateuserid(suserid) { = 'wait';
  // Create an instance of the XML HTTP Request object
  var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
  // Prepare the XMLHTTP object for a HTTP POST to our validation page
  var sURL = "http://localhost/MyPractice/check.aspx"; "POST", sURL, false );
  oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  // Execute the request
  oXMLHTTP.send("userID=" + suserid);
  if (oXMLHTTP.responseText == "exists")
   document.getElementById("test").innerText = "Sorry - the User ID already exists.";
  document.getElementById("test").innerText = "the User ID is available.";
   <form id="form1" runat="server">
           <input type="text" name="userid" value="" onchange="validateuserid(this.value)">
           <span id="test"></span>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Check.aspx.cs" Inherits="Test" %>

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Test : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        string sUserID = Request.Form["userID"].ToString();
        if (sUserID == "Me")

No comments:

Post a Comment