The company asked me to write a user interface with another website, as shown below: Code
Using System;
Using System. collections;
Using System. componentmodel;
Using System. Data;
Using System. LINQ;
Using System. Web;
Using System. Web. Services;
Using System. Web. Services. Protocols;
Using System. xml. LINQ;
Namespace Userlogintest
{
/// <Summary>
/// Summary of checkuser
/// </Summary>
[WebService (namespace = " Http://tempuri.org/ " )]
[Webservicebinding (conformsto = Wsiprofiles. basicprofile1_1)]
[Toolboxitem ( False )]
// To allow ASP. Net ajax to call this web service from a script, uncomment the downstream service.
// [System. Web. Script. Services. scriptservice]
Public Class Checkuser: system. Web. Services. WebService
{
/// <Summary>
/// Do not verify the Method
/// </Summary>
/// <Returns> </returns>
[Webmethod]
Public String Helloworld ()
{
Return " Hello World " ;
}
PublicMysoapheader soaphead= NewMysoapheader ();
/// <Summary>
/// Verification Method
/// </Summary>
/// <Param name = "userid"> </param>
/// <Param name = "username"> </param>
/// <Param name = "MSG"> </param>
/// <Returns> </returns>
[Soapheader ( " Soaphead " )]
[Webmethod]
Public Bool Getuserinfo ( Int Userid, String Username, Out String MSG)
{
String Deusername = Encrypthelper. decrypt (username, " Jjjyzy " );
MSG = String . Empty;
If ( ! Soaphead. isvalid ( Out MSG ))
{ Return False ;}
Else
{
ReturnCheckcount (userid, deusername );
}
}
/// <Summary>
/// Query ID and account
/// </Summary>
Private Bool Checkcount ( Int Userid, String Username)
{
String Sqlstr = " Select Table where id = userid and username = Username " ;
Return True;
}
}
/// <Summary>
/// Soaphead verification method account password LY (override a class)
/// </Summary>
Public Class Mysoapheader: system. Web. Services. Protocols. soapheader
{
Public String Wsusername
{ Get ; Set ;}
Public String Wspwd
{ Get ; Set ;}
PublicMysoapheader ()
{
}
Public Bool Isvalid ( Out String MSG)
{
Return Isvalid (wsusername, wspwd, Out MSG );
}
Private Bool Isvalid ( String Wsusername, String Wspwd, Out String MSG)
{ // , Out string msg
MSG = String . Empty;
If (Wsusername = " Ly " & Wspwd = " Ly " )
{Msg = " You have the right to call " ; Return True ;}
Else{Msg= "You are not authorized to call";Return False;}
}
}
}