Click here to Skip to main content
15,917,702 members
Home / Discussions / Web Development
   

Web Development

 
QuestionHow can we prevent Search Engines Caching or indexing ? Pin
Mohammad Dayyan1-Oct-08 15:59
Mohammad Dayyan1-Oct-08 15:59 
AnswerRe: How can we prevent Search Engines Caching or indexing ? Pin
Christian Graus1-Oct-08 16:06
protectorChristian Graus1-Oct-08 16:06 
GeneralRe: How can we prevent Search Engines Caching or indexing ? Pin
Mohammad Dayyan1-Oct-08 16:12
Mohammad Dayyan1-Oct-08 16:12 
GeneralRe: How can we prevent Search Engines Caching or indexing ? Pin
Christian Graus1-Oct-08 16:38
protectorChristian Graus1-Oct-08 16:38 
AnswerRe: How can we prevent Search Engines Caching or indexing ? Pin
Philip.F14-Oct-08 23:13
Philip.F14-Oct-08 23:13 
GeneralRe: How can we prevent Search Engines Caching or indexing ? Pin
Mohammad Dayyan14-Oct-08 23:17
Mohammad Dayyan14-Oct-08 23:17 
QuestionIE7 rendering bug Pin
Christian Graus1-Oct-08 15:35
protectorChristian Graus1-Oct-08 15:35 
QuestionHow to Avoid session Pin
suresh_0011-Oct-08 12:03
suresh_0011-Oct-08 12:03 
Hi:
In my project for "Change Password Module" i am implementing following Logic:

1) User will Enter the OldPassword,NewPassword,Confirm Password then i am checking wether the Old Password is exists

2)If the OldPassword Exists I am setting Customvalidator =true and Maintaining session value=1

3)Now i am calling the session value in "Accept" buttonClick event in which i am cheking wether the session variable is one"

4)If the value is one, the Newly entered password will be updated otherwise Error message will be displayed.

The issue is session variable should not be used .Instead of session alternative method should be used.Can any one send me code for Change Password without using session variable.


I have mentioned the code below.


My code:


**************************Presentation Layer****************************


/// <summary>
/// Update The password
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void imgaccept_Click(object sender, ImageClickEventArgs e)
{
try
{
if (Page.IsValid == true)
{
if (Convert.ToString(Session["Validapassword"]) == "1")
{

Hashtable Has_PWDupdate = new Hashtable();

//Adding Values into Hashtable
Has_PWDupdate.Add("username",Session["UserName"].ToString());
Has_PWDupdate.Add("password", DAMS_Cls_EncryptDecrypt.Encrypt(txtNewpassword.Text));

ChangePWD.ChangePassword(Has_PWDupdate);

string strScript = "";
string strPath = "HomePage.aspx";
strScript = strScript + "<script language='javascript'>";
strScript = strScript + "alert('Your password successfully changed.');";
strScript = strScript + "window.location.href='" + strPath + "';";
strScript = strScript + "</script>";
ScriptManager.RegisterStartupScript(this, Type.GetType("System.String"), "Message", strScript, false);

}
}
}
catch (Exception ex)
{
throw ex;
}
}

/// <summary>
/// If CancelButton is Clicked,Page will be redirected to the Changepassword Page
/// </summary>
/// <param name="source">The source.</param>
/// <param name="arg">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>

protected void CheckSelectedStateValue(object source, ServerValidateEventArgs arg)
{
try
{
bool oldPasswordExist;

//Check for UserName and Password Valid
Hashtable has_pwdChange = new Hashtable();
has_pwdChange.Add("username", Session["UserName"].ToString());
has_pwdChange.Add("OldPassword", DAMS_Cls_EncryptDecrypt.Encrypt(txtOldPassword.Text));

oldPasswordExist = ChangePWD.CheckOldPassword(has_pwdChange);


// Check for oldPasswordExist
if (oldPasswordExist == true)
{
arg.IsValid = true;

//If oldPWD is Exist Then Value '1' is Assign to the Session Variable "Validapassword"
Session.Add("Validapassword", 1);

}
else
{
arg.IsValid = false;
}
}
catch (Exception ex)
{
throw ex;
}
}






***************BusinessLogic Lyer********************



/// <summary>
/// Change Password
/// </summary>
/// <param name="Has_PWDupdate"></param>

public void ChangePassword(Hashtable Has_PWDupdate)
{
try
{
Hashtable hsh = new Hashtable();
hsh.Add("@UserName", Has_PWDupdate["username"].ToString());
hsh.Add("@Password", Has_PWDupdate["password"].ToString());

DAMS_cls_DataAccess.ExecuteCommand("DAMS_SP_Password_Update", hsh);
}
catch (Exception ex)
{

throw ex;
}
}


/// <summary>
/// Check Whether Old Password is Exists
/// </summary>
/// <param name="CheckOldPWD"></param>
/// <returns></returns>

public bool CheckOldPassword(Hashtable CheckOldPWD)
{
try
{
Hashtable hsh = new Hashtable();
hsh.Add("@UserName", CheckOldPWD["username"].ToString());

bool isExist = false;

SqlDataReader drDAMS_PWDchange;
drDAMS_PWDchange = DAMS_cls_DataAccess.GetDataReader("DAMS_SP_IsOldPasswordExist", hsh);

//Check for row Count
if (drDAMS_PWDchange.HasRows)
{
//Read The UserName in datareader
while (drDAMS_PWDchange.Read())
{
if (drDAMS_PWDchange.GetValue(0).ToString() == CheckOldPWD["OldPassword"].ToString())
{
isExist = true;
}
else
{
isExist = false;
}
}

}

return isExist;
}

catch (Exception ex)
{

throw ex;
}

}

suresh

AnswerRe: How to Avoid session Pin
Christian Graus1-Oct-08 15:13
protectorChristian Graus1-Oct-08 15:13 
AnswerRe: How to Avoid session Pin
Jaffer Mumtaz2-Oct-08 0:33
Jaffer Mumtaz2-Oct-08 0:33 
GeneralRe: How to Avoid session Pin
Christian Graus2-Oct-08 0:54
protectorChristian Graus2-Oct-08 0:54 
QuestionA DHTML question ? Pin
Mohammad Dayyan1-Oct-08 11:32
Mohammad Dayyan1-Oct-08 11:32 
AnswerRe: A DHTML question ? Pin
Shog91-Oct-08 11:50
sitebuilderShog91-Oct-08 11:50 
GeneralRe: A DHTML question ? Pin
Mohammad Dayyan1-Oct-08 12:00
Mohammad Dayyan1-Oct-08 12:00 
Questioni need a simple piece of code [modified] Pin
brimbis1-Oct-08 7:15
brimbis1-Oct-08 7:15 
AnswerRe: i need a simple piece of code Pin
User 17164921-Oct-08 8:06
professionalUser 17164921-Oct-08 8:06 
GeneralRe: i need a simple piece of code Pin
brimbis1-Oct-08 9:21
brimbis1-Oct-08 9:21 
QuestionJavaScript using Client-Side FSO CopyFile Pin
jonatec1-Oct-08 5:08
jonatec1-Oct-08 5:08 
AnswerRe: JavaScript using Client-Side FSO CopyFile Pin
Ashfield2-Oct-08 3:47
Ashfield2-Oct-08 3:47 
GeneralRe: JavaScript using Client-Side FSO CopyFile Pin
jonatec2-Oct-08 6:07
jonatec2-Oct-08 6:07 
GeneralRe: JavaScript using Client-Side FSO CopyFile Pin
Ashfield2-Oct-08 8:36
Ashfield2-Oct-08 8:36 
QuestionPDF content not rendering Pin
kc_krishnan30-Sep-08 22:56
kc_krishnan30-Sep-08 22:56 
AnswerRe: PDF content not rendering Pin
kc_krishnan1-Oct-08 4:59
kc_krishnan1-Oct-08 4:59 
QuestionASP .net app, and server side assembly that needs to read an XSL resource Pin
Braulio Dez30-Sep-08 19:57
Braulio Dez30-Sep-08 19:57 
QuestionHow to update a HTML textbox from a 'C' executable running in the background Pin
sccjazz130-Sep-08 16:20
sccjazz130-Sep-08 16:20 

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.