ASP classic like code behind on the page

<% @Page Language="VB" %><%@ Import Namespace="System.Xml" %><script runat="server">    Protected Sub btnsubmit_Click(sender As Object, e As EventArgs)        lblErrorMessage.Text = string.Empty        Dim errorString As String = String.Empty    Dim userId As String = frmUserName.Text.Trim()    Dim password As String = frmPassword.Text.Trim()    Dim status As String = String.Empty    Dim message As String = String.Empty    'bool serviceWorkedProperly = false;    Try        Dim xmlStream As New XmlDocument()        Dim root As XElement        Dim WEBSERVICE As String = string.Format("{0}&password={1}", userId, password)        xmlStream.Load(WEBSERVICE)        root = XElement.Load(WEBSERVICE)        status = root.Value        Dim ErrorCodes As String() = New String(6) {}        ErrorCodes(0) = "Authenticated"        ErrorCodes(1) = "Username not found"        '"Credentials not found"        ErrorCodes(2) = "Password is incorrect"        ErrorCodes(3) = "Credentials not found"        ErrorCodes(4) = "Expired or inactive"        ErrorCodes(5) = "Unknown Exception"        ErrorCodes(6) = "ValidationError"        errorString = Array.Find(ErrorCodes, Function(element) element.Equals(status))        If errorString Is Nothing Then            errorString = "errorstring is empty"        End If    Catch ex As Exception        errorString = ex.Message    End Try        lblErrorMessage.Visible = True        lblErrorMessage.Text = errorStringEnd Sub</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><html xmlns="" ><head runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="server">    <div>        <asp:Label ID="lblErrorMessage" runat="server" Visible="false" />        <br /><br />        Username: <asp:TextBox ID="frmUserName" runat="server" />                            <asp:RequiredFieldValidator ID="valfrmUserName" runat="server" ErrorMessage="* Username Required" ControlToValidate="frmUserName" />        <br />        Password: <asp:TextBox ID="frmPassword" runat="server" TextMode="Password" />        <asp:RequiredFieldValidator ID="valfrmPassword" runat="server" ErrorMessage="* Password Required" ControlToValidate="frmPassword" />        <asp:Button ID="btnsubmit" runat="server" Text="Login" OnClick="btnsubmit_Click" />    </div>    </form></body></html>

Leave a Reply

Your email address will not be published. Required fields are marked *