Click here to Skip to main content
15,922,696 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to redirect ot desired page after forms authentication Pin
luckyve21-Feb-07 2:24
luckyve21-Feb-07 2:24 
Generalits not working Pin
rama charan21-Feb-07 3:09
rama charan21-Feb-07 3:09 
QuestionDELETE FILE Pin
Sam Heller20-Feb-07 22:30
Sam Heller20-Feb-07 22:30 
AnswerRe: DELETE FILE Pin
Sandeep Akhare20-Feb-07 22:54
Sandeep Akhare20-Feb-07 22:54 
Questionpersist session variables Pin
PandemoniumPasha20-Feb-07 22:29
PandemoniumPasha20-Feb-07 22:29 
AnswerRe: persist session variables Pin
Sam Heller20-Feb-07 22:30
Sam Heller20-Feb-07 22:30 
AnswerRe: persist session variables Pin
Sandeep Akhare20-Feb-07 22:44
Sandeep Akhare20-Feb-07 22:44 
GeneralRe: persist session variables Pin
PandemoniumPasha20-Feb-07 23:11
PandemoniumPasha20-Feb-07 23:11 
here is the code:
when the user clicks the login button the following code gets executed:

Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
' Attempt to Validate User Credentials using UsersDB from XML file
Dim accountSystem As New ProcessNowUser
if accountSystem.AuthenticateUser(txtUserID.Text, txtPassword.Text) Then
Session("UserID") = accountSystem.UserID
Session("DisplayName") = accountSystem.UserName
FormsAuthentication.RedirectFromLoginPage(accountSystem.UserName, False)
Else
Message.InnerText = "Sorry ! Login Failed. Please try again."
End If
End Sub

when the user clicks the change password button the function below is called and the new password is saved in the XML file. But when the page reloads the all session variables lose their value.

Private Sub btnChangePassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangePassword.Click
If isPageValid() Then
Dim changePwd As New ProcessNowUser
Dim sResults As String = changePwd.ChangePassword(Session("DisplayName").ToString.Trim, txtCurrentPassword.Text.Trim, txtNewPassword.Text.Trim)
If sResults.Equals("No Password") Then
ShowMessage("Password doesnot match!", Me)
Else
ShowMessage("Password changed successfully!", Me)
End If
End If
End Sub

Public Function ChangePassword(ByVal userName As String, ByVal OldPassword As String, ByVal NewPassword As String) As String
Dim returnValue As String = ""
Dim dvUsers As DataView = _dsDataStore.Tables("Users").DefaultView
dvUsers.RowFilter = "username='" & userName & "'"
If dvUsers.Count > 0 Then
Dim sPublicKey As String = dvUsers(0)("key")
Dim sEncryptedPassword As String = dvUsers(0)("password")
Dim sDecryptedPassword As String = Utility.DecryptTripleDES(sEncryptedPassword, sPublicKey)
If sDecryptedPassword = OldPassword Then
dvUsers(0)("password") = Utility.EncryptTripleDES(NewPassword, sPublicKey)
dvUsers(0)("key") = sPublicKey
updatexmlOnly(_dsDataStore)
returnValue = "OK"
Else
returnValue = "No Password"
End If
Else
returnValue = "No User"
End If
Return returnValue
End Function

Private Sub updatexmlOnly(ByVal ds As DataSet)
If IO.File.Exists(_sTargetDirectory & XML_DATA_DIRECTORY & "adminuser.xml") Then
IO.File.Delete(_sTargetDirectory & XML_DATA_DIRECTORY & "adminuser.xml")
End If
ds.WriteXml(_sTargetDirectory & XML_DATA_DIRECTORY & "adminuser.xml")
End Sub
GeneralRe: persist session variables Pin
Marcus J. Smith21-Feb-07 2:49
professionalMarcus J. Smith21-Feb-07 2:49 
GeneralRe: persist session variables Pin
PandemoniumPasha21-Feb-07 23:28
PandemoniumPasha21-Feb-07 23:28 
QuestionAuto expanding tree view? Pin
Hossrod20-Feb-07 21:14
Hossrod20-Feb-07 21:14 
Questionhow to use crystal report viewer with parameater Pin
findtango20-Feb-07 21:10
findtango20-Feb-07 21:10 
AnswerRe: how to use crystal report viewer with parameater Pin
Sylvester george20-Feb-07 21:24
Sylvester george20-Feb-07 21:24 
GeneralRe: how to use crystal report viewer with parameater Pin
findtango20-Feb-07 21:34
findtango20-Feb-07 21:34 
Questioneditable dropdownlist Pin
jabbarsb20-Feb-07 20:59
jabbarsb20-Feb-07 20:59 
AnswerRe: editable dropdownlist Pin
Sylvester george20-Feb-07 21:26
Sylvester george20-Feb-07 21:26 
GeneralRe: editable dropdownlist Pin
Vsree20-Feb-07 22:06
Vsree20-Feb-07 22:06 
GeneralRe: editable dropdownlist Pin
Sam Heller20-Feb-07 22:36
Sam Heller20-Feb-07 22:36 
GeneralRe: editable dropdownlist Pin
Sylvester george20-Feb-07 23:10
Sylvester george20-Feb-07 23:10 
GeneralRe: editable dropdownlist Pin
Vsree21-Feb-07 0:13
Vsree21-Feb-07 0:13 
GeneralRe: editable dropdownlist Pin
Sam Heller21-Feb-07 0:17
Sam Heller21-Feb-07 0:17 
GeneralRe: editable dropdownlist Pin
Sylvester george21-Feb-07 0:20
Sylvester george21-Feb-07 0:20 
GeneralRe: editable dropdownlist Pin
jabbarsb21-Feb-07 2:35
jabbarsb21-Feb-07 2:35 
Questionhow to find the disk space of a drive in Windows Services Pin
ramyasangeet20-Feb-07 20:50
ramyasangeet20-Feb-07 20:50 
AnswerRe: how to find the disk space of a drive in Windows Services Pin
Sylvester george20-Feb-07 20:54
Sylvester george20-Feb-07 20:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.