Click here to Skip to main content
15,888,177 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionError retrieving password Pin
Cyberpulse31-Mar-09 8:33
Cyberpulse31-Mar-09 8:33 
Questionsending email in ASP.NET Pin
Ariful Islam Sabuz31-Mar-09 5:05
Ariful Islam Sabuz31-Mar-09 5:05 
AnswerRe: sending email in ASP.NET Pin
Yusuf31-Mar-09 5:17
Yusuf31-Mar-09 5:17 
AnswerRe: sending email in ASP.NET Pin
Abhijit Jana31-Mar-09 5:21
professionalAbhijit Jana31-Mar-09 5:21 
AnswerRe: sending email in ASP.NET Pin
sheemap31-Mar-09 5:51
sheemap31-Mar-09 5:51 
Questionhow do we implement the themes in the button click event instead of Page_PreInit event Pin
M.Ramesh31-Mar-09 4:27
M.Ramesh31-Mar-09 4:27 
AnswerRe: how do we implement the themes in the button click event instead of Page_PreInit event Pin
Yusuf31-Mar-09 4:54
Yusuf31-Mar-09 4:54 
Questionencrypting passwords and accessing textboxes within a formview Pin
mh.31107831-Mar-09 3:59
mh.31107831-Mar-09 3:59 
hey,
im trying to encrypt my passwords before i send them to my sql server 2008 database, however when i try accessing the textboxs that are within a formview i just get the message does not exsist in the current context and im just wondering i would be able to get around this or perhaps an alternative way to encrypting my passwords.

thank you


behind code
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Security.Cryptography;
using System.Data.Sql;
using System.Data.Common;


public partial class AddMember : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
TextBox EncryptPassword = FormView1.FindControl("PasswordTextBox") as TextBox;

string hash = FormsAuthentication.HashPasswordForStoringInConfigFile(EncryptPassword.Text, "MD5");

((TextBox)FormView1.FindControl("PasswordTextBox")).Text = hash;

}

}


asp code

<asp:FormView ID="FormView1" runat="server" DataKeyNames="UserID"
DataSourceID="SqlDataSource1" Height="325px" style="text-align: left"
Width="584px"
onpageindexchanging="FormView1_PageIndexChanging">
<EditItemTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="UserID"
DataSourceID="SqlDataSource1" style="margin-bottom: 0px" Width="588px">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True"
SortExpression="UserID" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
<asp:BoundField DataField="Password" HeaderText="Password"
SortExpression="Password" />
<asp:BoundField DataField="ContractedHours" HeaderText="ContractedHours"
SortExpression="ContractedHours" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Return" />
<br />
</EditItemTemplate>
<InsertItemTemplate>
<div class="style13">
<br />
UserID:
<asp:TextBox ID="UserIDTextBox" runat="server" style="margin-left: 20px"
Text='<%# Bind("UserID") %>' />
&nbsp;
<asp:RequiredFieldValidator ID="UserIDValidator" runat="server"
ControlToValidate="UserIDTextBox" Display="Dynamic"
ErrorMessage="* User ID Required">* User ID Required</asp:RequiredFieldValidator>
<br />
<br />
FirstName:
<asp:TextBox ID="FirstNameTextBox" runat="server"
Text='<%# Bind("FirstName") %>' />
&nbsp;
<asp:RequiredFieldValidator ID="FirstNameValidator" runat="server"
ControlToValidate="FirstNameTextBox" Display="Dynamic"
ErrorMessage="*Name Required">*Name Required</asp:RequiredFieldValidator>
<br />
<br />
LastName:
<asp:TextBox ID="LastNameTextBox" runat="server"
Text='<%# Bind("LastName") %>' />
&nbsp;
<asp:RequiredFieldValidator ID="SurnameValidator" runat="server"
ControlToValidate="LastNameTextBox" Display="Dynamic"
ErrorMessage="*Name Required">*Name Required</asp:RequiredFieldValidator>
<br />
<br />
Password:&nbsp;<asp:TextBox ID="PasswordTextBox" runat="server"
Text='<%# Bind("Password") %>' />
&nbsp;
<asp:RequiredFieldValidator ID="PasswordInputValidator" runat="server"
ControlToValidate="PasswordTextBox" ErrorMessage="*Password Required">*Password Required</asp:RequiredFieldValidator>
<br />
<br />
Confirm
<br />
Password:
<asp:TextBox ID="PasswordConfirmationTextBox" runat="server"></asp:TextBox>
&nbsp;
<asp:CompareValidator ID="PasswordCompareValidator" runat="server"
ControlToCompare="PasswordTextBox"
ControlToValidate="PasswordConfirmationTextBox" Display="Dynamic"
ErrorMessage="*Password do not match">*Password do not match</asp:CompareValidator>
<br />
<br />
Contracted<br />
Hours:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="HoursTextBox" runat="server"
Text='<%# Bind("ContractedHours") %>' Width="34px" />
&nbsp;<asp:RequiredFieldValidator ID="HoursValidator" runat="server" ControlToValidate="HoursTextBox"
Display="Dynamic" ErrorMessage="*Hours Required">*Hours Required</asp:RequiredFieldValidator>
&nbsp;<asp:RangeValidator ID="HoursRangeValidator" runat="server" ControlToValidate="HoursTextBox"
Display="Dynamic" ErrorMessage="*not within range" MaximumValue="40"
MinimumValue="12">*not within range</asp:RangeValidator>
<br />
<br />
Admin:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:CheckBox ID="AdminCheckBox" runat="server" />
<br />
<br />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" onclick="InsertButton_Click" Text="Insert" />
&nbsp;&nbsp;
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<br />
<br />
</div>
</InsertItemTemplate>
Questionto retrieve image from sqlserver and display it in grid view Pin
maheshsahini31-Mar-09 3:27
maheshsahini31-Mar-09 3:27 
AnswerRe: to retrieve image from sqlserver and display it in grid view Pin
Colin Angus Mackay31-Mar-09 3:30
Colin Angus Mackay31-Mar-09 3:30 
GeneralRe: to retrieve image from sqlserver and display it in grid view Pin
maheshsahini31-Mar-09 3:34
maheshsahini31-Mar-09 3:34 
AnswerRe: to retrieve image from sqlserver and display it in grid view Pin
Abhijit Jana31-Mar-09 3:41
professionalAbhijit Jana31-Mar-09 3:41 
GeneralRe: to retrieve image from sqlserver and display it in grid view Pin
maheshsahini31-Mar-09 3:44
maheshsahini31-Mar-09 3:44 
GeneralRe: to retrieve image from sqlserver and display it in grid view Pin
zy5187593931-Mar-09 17:49
zy5187593931-Mar-09 17:49 
AnswerRe: to retrieve image from sqlserver and display it in grid view Pin
Ch.Gayatri Subudhi31-Mar-09 19:42
Ch.Gayatri Subudhi31-Mar-09 19:42 
QuestionConnect to report sever via code Pin
mehrdadc4831-Mar-09 3:26
mehrdadc4831-Mar-09 3:26 
AnswerRe: Connect to report sever via code Pin
Yusuf31-Mar-09 4:57
Yusuf31-Mar-09 4:57 
QuestionNeed Help Pin
Anand Ranjan Pandey31-Mar-09 3:11
professionalAnand Ranjan Pandey31-Mar-09 3:11 
AnswerRe: Need Help Pin
Colin Angus Mackay31-Mar-09 3:19
Colin Angus Mackay31-Mar-09 3:19 
QuestionRadio Streaming Pin
aneeshmabdul31-Mar-09 3:09
aneeshmabdul31-Mar-09 3:09 
Questioncopy omage from one table to another sql server Pin
rajshadesmunde31-Mar-09 2:25
rajshadesmunde31-Mar-09 2:25 
AnswerRe: copy omage from one table to another sql server Pin
Alok Sharma ji31-Mar-09 3:01
Alok Sharma ji31-Mar-09 3:01 
AnswerRe: copy omage from one table to another sql server Pin
Alok Sharma ji31-Mar-09 3:02
Alok Sharma ji31-Mar-09 3:02 
QuestionGet Visitor's IP address Pin
.NET- India 31-Mar-09 2:23
.NET- India 31-Mar-09 2:23 
AnswerRe: Get Visitor's IP address Pin
Colin Angus Mackay31-Mar-09 2:55
Colin Angus Mackay31-Mar-09 2:55 

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.