I am implementing MembershipProvider
class. Most of the methods are not implemented, and I am throwing NotImplementedException
in those.
But ValidateUser is being used:
public override bool ValidateUser(string UserName, string Password)
Now what I want is to add some more parameters to it. Something like this will do the trick:
public override bool ValidateUser
(
string UserName,
string Password,
string IpAddress,
string BrowserName
)
This is an example. Once I could add some more parameters, I can combine them in an object and then make a call to database layer.
I have searched a lot but could not find a way which works. Some people say it cannot be done and some say it can be.
Thanks for your help.
Thanks Win. I required some more parameters too besides IP and browser info.
What I ended up doing it putting everything (UserName
, Password
, additional parameters) in XML and sending it as username. Then in password
, I had a flag which looks if it should do something different.
public override bool ValidateUser(string username, string password)
{
if (password == "XML")
{
// This contains additional information in username.
DatabaseLayerObject.ValidateUser(username);
}
else
{
// This is conventional call.
DatabaseLayerObject.ValidateUser(username, password);
}
}
UPDATE 1:
I am adding some more information to clarify my response.
When I want to send more information in addition to username
and password
, I will put all of them in XML, and store this information in username
. E.g.:
<UserName>MyUserName</UserName>
<Password>MyPassword</Password>
<City>NameOfCity</City>
<Country>NameOfCountry</Country>
Now I need some indication in the ValidateUser
method to know whether I am sending XML or not. This flag is in password
, stored as any string of my choice.