Home > Net >  The.net issue RMB for help, type mismatch errors.
The.net issue RMB for help, type mismatch errors.

Time:09-22

Site operating environment: the IIS 7.0, Windows 2008 R2, MS Sql Server 2005
Web development: asp.net
RMB 100 for help,

I can't find out where the type mismatch, RMB for help and will never break your word,
-- -- --

An error screenshot is as follows:


An error is part of the source code (line 40) :
 protected void Button1_Click (object sender, System. EventArgs e) 
{
The UserData UserData.
if(! Page. IsValid)
{
return ;
}

//
//judgment before login user have any cancellation, if not, cancel first
//
If (this. LoginUserData!=null)
{
//
//modify the user last logged on time
//
ApplicationAssert. Check (false, "exit success!" , ApplicationAssert. UserLogout, enclosing loginUserData);
This. LoginUserData. Tables [UserData. USERS_TABLE]. Rows [0] [UserData. LASTLOGOUTTIME_FIELD]=DateTime. Now;
(new UserSystem ()). ModifyUser (enclosing loginUserData);
//
//cancel all data
//
LoginUserData=https://bbs.csdn.net/topics/null;
The Users=null;
FormsAuthentication. SignOut ();
Request. Cookies. The Clear ();
The Session. The Clear ();

}

//
//to password encryption
//
SHA1 SHA1=SHA1. The Create ();
Byte [] password=sha1.Com puteHash (Encoding. Unicode. GetBytes (MPwd. Text. The Trim ()));

//
//according to the user name and password to get the corresponding data
//
The userData=https://bbs.csdn.net/topics/(new UserSystem ()). GetUserDataByName (MName. Text. The Trim (), password);

//
//according to the data, to determine whether a user login successfully, such as success is created id ticket, and add roles
//
If (userData=null https://bbs.csdn.net/topics/=
{
LoginInfo. Visible=true;
ApplicationAssert. Check (false, "login failed! User name: "+ MName. Text +" ", ApplicationAssert. UserLogin, enclosing loginUserData);
return;
}




GetUserDataByName function has been packaged in a DLL, the source code is:
 public UserData GetUserDataByName (string userName, byte [] userPwd) 
{
ApplicationAssert. CheckCondition (userName!=string. The Empty, "must enter the user name login!" , ApplicationAssert. LineNumber);
ApplicationAssert. CheckCondition (userPwd Length!=0, "must enter the user login password!" , ApplicationAssert. LineNumber);
The UserData byName=new UserRules (.) GetByName (userName);
If (byName!=null)
{
DataRowCollection rows=byName. Tables [r]. "Admin" rows;
If (rows. Count==1)
{
Byte [] storedPassword=(byte []) rows [0] (" UserPwd ");
If (this.Com parePasswords (storedPassword, userPwd))
{
Return the byName;
}
return null;
}
}
return null;
}



CodePudding user response:

I guess it is not the source of problem, or IIS configuration problem,
Can solve the problem of friends, I can direct messages, or reply,

CodePudding user response:

The
reference
byte [] storedPassword=(byte []) rows [0] (" UserPwd ");

Casting went wrong?
Conversion and judge commented code, logging rows [0] [" UserPwd "] values and see what is it

CodePudding user response:

GetUserDataByName function has been packaged in a DLL, the DLL without source code, so can't change,
I also think, may be the encapsulated function has a problem, but has been used before, was only recently reported the error,, good strange,
  • Related