EqImage secure

EqimageLogin.aspx


<%@ Page language="c#" Src="Reference.cs" AutoEventWireup="false" %>
<%@ import Namespace="Microsoft.Web.Services" %>
<%@ import Namespace="Microsoft.Web.Services.Security" %>
<script runat="server">

void Button1_Click(object sender, System.EventArgs e)
{
try
{
UsernameToken token = new UsernameToken(txtUserName.Text,txtPassword.Text,
PasswordOption.SendHashed);
//create proxy
EqImageProxy.CEqImageSecure proxy = new EqImageProxy.CEqImageSecure();
//Get Request SOAP context
SoapContext context = proxy.RequestSoapContext;
context.Security.Tokens.Add(token);

//Add time to Live to prevent tampering
context.Timestamp.Ttl = 60000;

//Call Web Service
double res = proxy.Compare( txtUrl1.Text, txtUrl2.Text );

this.lblOutput.Text = "Result: " + System.Convert.ToString( res );
if ( res == 0 ) {
this.lblOutput.Text += "<BR>Images are identical !";
Image1.ImageUrl = txtUrl1.Text;
Image1.Width= new Unit( "211px" );
Image1.Height= new Unit( "188px" );
Image2.ImageUrl = txtUrl2.Text;
Image2.Width= new Unit( "211px" );
Image2.Height= new Unit( "188px" );

} else if ( res == -1 ) {
this.lblOutput.Text += "<BR>Images not loaded !";
} else if ( res == -2 ) {
this.lblOutput.Text += "<BR>You are not authenticate ! You must log in.";
} else {
Image1.ImageUrl = txtUrl1.Text;
Image1.Width= new Unit( "211px" );
Image1.Height= new Unit( "188px" );
Image2.ImageUrl = txtUrl2.Text;
Image2.Width= new Unit( "211px" );
Image2.Height= new Unit( "188px" );
}
}
catch (Exception exp)
{
this.lblOutput.Text = "Result: -2";
this.lblOutput.Text += "<BR>You are not authenticate ! You must log in.";
}
}
</script>
<HTML>
<body bgcolor="#CC9966">
<form id="SecurityCredentialsClient" method="post" runat="server">
<h2>EqImage Secure client (url comparison)</h2>
<asp:Panel ID="pnlLogin" runat="server">
<TABLE width="500" bgColor="#efefef">
<tr>
<td bgcolor="#02027a" colspan="2"><font color="white"></font></td>
</tr>
<TR>
<TD><B>User Name:</B></TD>
<TD><asp:TextBox id="txtUserName" Runat="server"></asp:TextBox></TD>
</TR>
<TR>
<TD><B>Password:</B></TD>
<TD><asp:TextBox id="txtPassword" Runat="server" TextMode="Password"></asp:TextBox></TD>
</TR>
<TR>
<TD><B>Url 1 ( ex: http://www.domain.com/image1.jpg )</B></TD>
<TD><asp:TextBox id="txtUrl1" Runat="server"></asp:TextBox></TD>
</TR>
<TR>
<TD><B>Url 2 ( ex: http://www.domain.com/image2.jpg )</B></TD>
<TD><asp:TextBox id="txtUrl2" Runat="server"></asp:TextBox></TD>
</TR>
</TABLE>
<p>
<asp:Image id="Image1" runat="server" Width="0px" Height="0px"></asp:Image>
<asp:Image id="Image2" runat="server" Width="0px" Height="0px"></asp:Image>
</p>
<P>
<asp:Button id="btnSubmit" onclick="Button1_Click" runat="server" Text="Compare"></asp:Button><BR><BR>
* Enter any User Name and a value of <i>password</i> for the Password.<BR>
<BR><asp:Label id="lblOutput" Runat="server"></asp:Label>
</P>
</asp:Panel>
</form>
</body>
</HTML>