|
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") %>' />
<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") %>' />
<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") %>' />
<asp:RequiredFieldValidator ID="SurnameValidator" runat="server"
ControlToValidate="LastNameTextBox" Display="Dynamic"
ErrorMessage="*Name Required">*Name Required</asp:RequiredFieldValidator>
<br />
<br />
Password: <asp:TextBox ID="PasswordTextBox" runat="server"
Text='<%# Bind("Password") %>' />
<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>
<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:
<asp:TextBox ID="HoursTextBox" runat="server"
Text='<%# Bind("ContractedHours") %>' Width="34px" />
<asp:RequiredFieldValidator ID="HoursValidator" runat="server" ControlToValidate="HoursTextBox"
Display="Dynamic" ErrorMessage="*Hours Required">*Hours Required</asp:RequiredFieldValidator>
<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:
<asp:CheckBox ID="AdminCheckBox" runat="server" />
<br />
<br />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" onclick="InsertButton_Click" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<br />
<br />
</div>
</InsertItemTemplate>
|
|
|
|
|
hi,
i am making a photo album for my website, i was successful in inserting images in to sql server databse. bt i am stuck with how to retrieve the images in to a grid view, which when clicked should display the original image in a details view(jst as it happens in orkut). plz help me
|
|
|
|
|
If the images are in the database what I'd do is create a special page that has a query string parameter which is the ID of the image in the database. On that page, I'd override the Render method on the page and write out the byte array that's been retrieved from the database rather than issue an HTML stream.
|
|
|
|
|
can u plz expain it a bit more clearly.m new to asp.net nd i am using c#
|
|
|
|
|
|
i hav done it this way. bt i want to store it in database nd do it
|
|
|
|
|
One, store the image imgUrl in db.
Two, the images in your solution folder.
|
|
|
|
|
Hi u got any solution for your question.If yes please send the code to me. I did another way i posted in asp.net please check it out.But mine the same problem.
With Regards
Ch.Gayatri Subudhi
|
|
|
|
|
Hi,
I need to connect to a specified report server, and get the reports on it.
How can I connect to report get reports via code?
Best wishes
|
|
|
|
|
well you need to know how to connect to database, right? here CP Database Articles.[^] Plenty of them to learn from. Enjoy!
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hello experts,
I am using Visual Studio 3.5 with C#.
I have to develop a page which will provide all the post code of UK within a specific Post code. For eg if user will enter a post code like A9 9AA then how do I know what post code are within a 10 kilometers radius of a specific post code( A9 9AA)?
Please provide some source code or reference.
Any help will be really appreciated !!!
Thanks in Advance,
Anand
Cheers by,
Anand Ranjan
developer@esspl
www.anandranjanp.blogspot.com
|
|
|
|
|
Anand Ranjan Pandey wrote: Visual Studio 3.5 with C#.
You are using Visual Studio 2008 (which is version 9) with .NET 3.5 and C#3.0 (just to be pedantic about version numbers)
Anand Ranjan Pandey wrote: For eg if user will enter a post code like A9 9AA then how do I know what post code are within a 10 kilometers radius of a specific post code( A9 9AA)?
There are a number of solutions. Google's localSearch API will give you that information. (sorry, that won't answer the question "what postcodes are in a 10Km radius")
If you need this data in your local database you can buy postcode look up information from companies like the Royal Mail, GB Mail, the Ordnance Surcey, etc.
|
|
|
|
|
Any one can help me....?????
How to create live radio streaming program asp.net C#....
|
|
|
|
|
i have a image field in table1.
ow i want to copy that image to another table from code behind file.
i used byte array, memmory stream but nothing is working.
in which datatype should i retrive image and insert int 2nd table
|
|
|
|
|
hey correct that word omage or people ignore your question by this kind of error
dont show urslf a bot
|
|
|
|
|
bye the way try bit char n if it is not working then show your code snippet so we can help u more.
|
|
|
|
|
Hello Friend,
I want to get the Visitor's IP Address. For it, i'm using the following code
string hostName = Dns.GetHostName();
IPHostEntry hostEntry = Dns.GetHostEntry(hostName);
IPAddress[] ipAddress = hostEntry.AddressList;
string name = null;
for(int i=0;i<ipAddress.Length;i++)
{
name = name + ipAddress[i].ToString()+"<br>";
}
Response.Write(name.ToString());
This code is showing the correct IPAddress of the local computer on localhost but as i upload this code over my server it gives me the following IPAddress not of my computer
66.63.181.68
66.63.181.93
216.45.55.186
Secondly, i use the following code
string hostName1 = Request.UserHostName.ToString();
Response.Write(hostName1.ToString());
But this is giving the IPAddress of the Main computer, I mean there are four computers, sharing the internet connection from my PC and when i visit the page from any of those computers it always give me the IP of my PC
|
|
|
|
|
.NET- India wrote: I mean there are four computers, sharing the internet connection from my PC and when i visit the page from any of those computers it always give me the IP of my PC
That is correct. That is the IP Address all the computers on the internet see for your computers.
All the PCs in my office return the same public IP address if I go to somewhere like http://www.ipchicken.com[^]
|
|
|
|
|
did u try your script to run on client side
|
|
|
|
|
Alok sharma ji wrote: did u try your script to run on client side
I'm not running any script.
Any if a script is run on the client side and gets a private IP address internal to a specific network it will not help the original posters problem because the IP address will likely clash with another machine in a different network.
|
|
|
|
|
Can you explain your ans. a bit more
|
|
|
|
|
Ok sir, i got it but i've that particular system information is it any way please suggest me
|
|
|
|
|
.NET- India wrote: i got it but i've that particular system information is it any way please suggest me
That statement doesn't make any sense.
Getting someones private IP address from somewhere on the internet is pointless because it will clash with other people. A private IP Address is unique only within the context of the private network.
From the perspective of another computer on the internet there is only the public IP address. Essentially your PC is acting as a router and will translate the destination IP address on incoming traffic to route it to the correct computer. The outside world will only see the public IP address. It won't even know there is a network sitting behind the device on that public IP address.
|
|
|
|
|
yes!!!!why shouldn't i see that first you are running on lan so what you expect of
|
|
|
|
|
Alok sharma ji wrote: so what you expect of
You seem to have missed out a large chunk of that sentence.
Alok sharma ji wrote: why shouldn't i see that first you are running on lan
Why should anyone care?
Applications don't care. All they care about is that the network routes the packets correctly. How that happens isn't of concern to applications. The fact that your router will send out a packet, replacing the internal header with a public header so the response can find its way back isn't of concern. The fact that the router will take the header of the response and replace it with internal routing information again isn't of concern to an application. It is only of concern to low level network infrastructure.
For example, when you come to Code Project do you know you'll be served your request by any one of 20+ web servers? Do you know their individual IP addresses? Do you care? Does your browser care? No! It doesn't. All it knows is the IP of the load balancer. How the load balancer translates that internally isn't your concern. Most of the time you won't even know there is a load balancer in place. It looks like you are communicating directly with the web server and that is how it should be.
|
|
|
|