divati,
First of all, I'd like to thank for the quick response.
On the other hand, I'd tried your solution before posting the question. I
think that it'd be better to explain in detail of what I've done so far.
Here's the code I've written on the cmdLogin_ServerClick() event procedure:
If Page.IsValid Then
Dim accountSystem As New
ClubCorporativoCOM.Versatec.ClubCorporativo.Seguri dad
Dim userId As String =
accountSystem.LoginIsValid(txtUserName.Value, txtUserPass.Value)
If userId = "1" Then
Dim objPWD As New
ClubCorporativoCOM.Versatec.ClubCorporativo.Seguri dad, intRetCode As
Integer, strRetMessage As String
objPWD.VerificaPWD(txtUserName.Value, intRetCode,
strRetMessage)
If intRetCode = 0 Then
Response.Redirect("CambiarPWD.aspx") <== HERE'S THE
ERROR!!!
End If
FormsAuthentication.SetAuthCookie(txtUserName.Valu e, False)
If
CType(ConfigurationSettings.AppSettings("useDefaul tPageFromLogin"), Boolean)
= False Then
Response.Redirect(ConfigurationSettings.AppSetting s("redirectDefaultUrl").ToString)
Else
Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Value,
False))
End If
Else
Me.lblMsg.Visible = True
Me.lblMsg.Text = "<" & "br" & ">" & strErrMsg & "<" & "br" &
">"
End If
End If
The problem lied as soon as I executed the response.redirect method because
it took me again to the logon web page. Why??? please, continue reading...
But then I studied the code line by line and found out that the infamous
error was the line:
FormsAuthentication.SetAuthCookie(txtUserName.Valu e, False)
had to be called before the lines:
If intRetCode = 0 Then
Response.Redirect("CambiarPWD.aspx") <== HERE'S THE
ERROR!!!
End If
The reason for this I guess was that, by the time the response.redirect line
was called the user had not yet been authenticated and therefore,
FormsAuthentication module redirected me to the logon screen. So first I
had to be authenticated, then create the cookie (by the SetAuthCookie
method) and then... had to redirect to the CambiarPWD.aspx to proceed by
changing the password.
At the end, it worked great!.
Thanks again for the help and patience.
Felix
"divati" <ak****@gmail.com> wrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Check last date of change password every login than count 30 days or 90
days.
DateTime LastChangePassword;
int DayOfPassword;
LastChangePassword.AddDays(DayOfPassword);
if (LastChangePassword > DayOfPassword)
{
Response.Redirect("ChangePassword.aspx");
}