473,383 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How To Assign Value To A Textbox In Passwordmode

Hi I Want To Retain The Value Of A Text Box Which Is In Password Mode. Pls Send Me I Already Use Cookie, Hidden Variable . Its Not Working
Mar 6 '07 #1
4 4494
vijaydiwakar
579 512MB
Hi I Want To Retain The Value Of A Text Box Which Is In Password Mode. Pls Send Me I Already Use Cookie, Hidden Variable . Its Not Working
try to use session veriable if it solves thy problem then ok else show me thy code
Mar 6 '07 #2
radcaesar
759 Expert 512MB
Sending the password in plain text to the browser is a bad idea from a
security standpoint so the default security settings discourage it.
(Anybody can do a view source for the page
and see the password)

However there is a workaround if you're determined. You can set the
password text via client side script.
Here's the simplest example I've seen:

MyPWTextBox.Attributes.Add("value", strPassword)

This server side code outputs the needed client side code
Mar 6 '07 #3
Frinavale
9,735 Expert Mod 8TB
Hi I Want To Retain The Value Of A Text Box Which Is In Password Mode. Pls Send Me I Already Use Cookie, Hidden Variable . Its Not Working
Do you want to use the value after its been submitted to server side code?
Mar 6 '07 #4
Hi I Want To Retain The Value Of A Text Box Which Is In Password Mode. Pls Send Me I Already Use Cookie, Hidden Variable . Its Not Working

Do like this your problem is solved


using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 DataAccessLayer;



public partial class loginform : System.Web.UI.Page
{
DataLayer dl = new DataLayer();

DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
lblerrormesg.Visible = false;
if (Request.Cookies["myCookie"] != null)
{
chkPersistLogin.Checked = true;

HttpCookie cookie = Request.Cookies.Get("myCookie");

txtemail.Text = cookie.Values["Email"].ToString();


string pass = cookie.Values["Pass"].ToString();
txtpassword.Attributes.Add("value", pass);

}
if (chkPersistLogin.Checked)
{

HttpCookie myCookie = new HttpCookie("myCookie");

//Response.Cookies.Remove("myCookie");

Response.Cookies.Add(myCookie);

myCookie.Values.Add("Email", txtemail.Text.ToString());

myCookie.Values.Add("Pass", txtpassword.Text.ToString());

DateTime dtExpiry = DateTime.Now.AddMinutes(15); //you can add years and months too here

Response.Cookies["myCookie"].Expires = dtExpiry;




}





}

protected void butnrealestlogin_Click(object sender, EventArgs e)
{

//CheckBox rm = (CheckBox)Login1.FindControl("chkPersistLogin");




string Email = txtemail.Text.ToString();
string Password = txtpassword.Text.ToString();

ds = dl.Login(Email, Password);
int i =ds.Tables["UserDetails"].Rows.Count;
if (i==1)
{
Session["Email"] = Email;
Session["UserName"] = ds.Tables[0].Rows[0][3].ToString();
Session["Phone"]=Convert.ToInt32(ds.Tables[0].Rows[0][4].ToString());






if (Request.Cookies["myCookie"] != null)
{

HttpCookie cookie = Request.Cookies.Get("myCookie");

string emailID = cookie.Values["Email"].ToString();

string password = cookie.Values["Pass"].ToString();
string pass = cookie.Values["Pass"].ToString();
txtpassword.Attributes.Add("value", pass);

}



int j=0;
string str=Request.QueryString["id"];
if (str!="ForumForm.aspx")
j=Convert.ToInt32(str);
if (j != 0)

Response.Redirect("PostReply.aspx?id=" + j);

if (str == "ForumForm.aspx")

Response.Redirect("ForumForm.aspx?parentform=login ");

string parentform = Request.QueryString["parentform"];
if (parentform == "PostyourQuestion")
Response.Redirect("PostyourQuestion.aspx");


if (parentform == "emailtoagent")
Response.Redirect("EmailtoAgent.aspx?&parentform=c heckbox");

if (parentform == "userprofile")
Response.Redirect("UserProfile.aspx");

else if(i==0)
{
Response.Write("Something went wrong... please re-enter your credentials...");
}

//string str1 = "<script language=javascript>";
//Response.Write("hi");
//str1 += "Self.close('FrentPage.aspx');";
//str1 += "</script>";
//Response.Write(str1);
Response.Write("Your Successfully LogedIn");

}
else if(i==0)
{
lblerrormesg.Visible = true;

lblerrormesg.Text = "Wrong EmailID or Password" + '\n' + '\n' + "Have your Register as Member?";
//Response.Redirect("Message.aspx?Id=1");
}
}
protected void lnkbutnclickhere_Click(object sender, EventArgs e)
{
Response.Redirect("Forgetpassword.aspx");
}
protected void lnkbutnsuggestion_Click(object sender, EventArgs e)
{
Response.Redirect("ContactUs.aspx");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("UserRegistration.aspx");
}



}
Sep 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New...
2
by: Grey | last post by:
I want to assign a value to HMTL textbox with id "txtABC" in ASP.NET with C#
1
by: Shilpi Chaudhry | last post by:
I have a forloop which I use to create textboxes - but unfortunately all of them have the same ids - I need to assign different ids to these textboxes creeated in the loop so that I can retrieve...
8
by: Sergei | last post by:
Hi, I am displaying modal dialog and passing values from the main form to the modal dialog and back. It works fine but if I used the following syntax on Page_Load(just for testing) in VB to...
15
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3"...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
1
by: Nathan Sokalski | last post by:
I have a form that is being used to edit account information. The form contains username and password TextBoxes, for which I set Enabled=False. When I assign the Text property the previous value,...
5
by: lianping | last post by:
Hi, I have a problem to assign a value into text box, below will be my script. Before view my script, let me hv quick explain on what is my problem: I would like to assign Java script value...
5
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
I had to create a HTML textbox to add the date time but I don't know how to assign the value with asp.net, how can I do that? This is my HTM Textbox code: <input id="txtFechaPlan"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.