Issue: Valid login values persist regardless of how I set field .Text values

I am seeing a problem where the login fields default to the last login values regardless of what values I set in the code.

For instance, if a valid account is "dog" and password is "bone", the login.aspx page always seems to load "dog" / "bone" regardless if I click on the Reset button, or enter an invalid login.
Am I doing something wrong in the code-behind for this web user control?


private void btnLogin_Click(object sender, System.EventArgs e)
{
if (FormsAuthentication.Authenticate(txtUsername.Text, txtPassword.Text))
{
lblFailedLogin.Text = "";
// sets authentication cookie and redirects page
if (Request.Params["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, chkPersist.Checked);
}
else
{
FormsAuthentication.SetAuthCookie(txtUsername.Text, chkPersist.Checked);
Response.Redirect("login.aspx");
}
}
else
{
lblFailedLogin.Text = "   Invalid credentials, please try again!";
}
}
private void btnReset_Click(object sender, System.EventArgs e)
{
txtUsername.Text = "";
txtPassword.Text = "";
}
}
0
Windstriker
1/8/2005 2:42:03 AM
asp.net.web-forms 93655 articles. 3 followers. Follow

0 Replies
423 Views

Similar Articles

[PageSpeed] 40

Reply:

Similar Artilces:

DataGrid not updating
Ok this is driving me nuts!I have a data grid and most of it's working - except the Update button. When I edit, it goes into edit mode correctly, but when I click update, it ignores my changes and reverts back to what it was. Here's my code: <form runat="server"> <div id="divBody">  <h2>Modify Sections</h2>  <asp:DataGrid id="dgSections" runat="server"    DataKeyField="ID"   AutoGenerateColumns="false"   Width="100%"   GridLines="None"   HeaderStyle-CssClass="ListHe...

Setting String Value with Label text value
Hi there, I am having some trouble setting a string value I want to use to save as part of reference name of an image file as below: Dim flName As String flName = imageLabel1.Text ImageLabel1 has its text value set from a slideshow extender control as below: ImageDescriptionLabelID="imagelabel1"The text value is set from the code below which in this case is SSCCamera1 MySlides(0) = New AjaxControlToolkit.Slide("http://www.outercam.co.uk/ssc/camera1.jpg", "ScottishSeabirdCentre", "SSCCamera1") The imagelabel1 displays the text correctly on the s...

setting non server control values: input type="text" how to set value programmatically?
<form id="someForm" runat="server" enableviewstate="true">  <input id="manualtextbox" type="text" value="abc" name="manualtextbox" /></form> I have access to user supplied value via: string userEnteredThisInForm = Request.Params["manualtextbox"] but, how can I set the value when sending form back to browser? If it's not runat="server" then you'll have to emit javascript to set the value: document.getElementById('manualtextbox').value = '<desired value>'; add runat="sever" to the control  <input id="manualtextbox" type="text" value="abc" name="m...

The value set to controls at client side donot persist for each page load, else it is again set to the default value...??
 I am trying to set date to the textbox field using javascript (Client side), the function is as follows. function From_calendarPicker(){                                var    sDPath = "../Calender.aspx";                 var    oWin = window.showModalDialog(sDPath, null, "dialogWidth:300px;dialogHeight:250px;help:0;status:0;scroll:0;center:1");  &nbs...

Setting field value before validation...
If the user enters an invalid value for a field I want to correct the error before validation occurs. Which event can I use to set a field's value before validation occurs. -- Thanks, Paul If you have a validation expression on a column in the datawindow there is no way to stop this from being executed. Another approach is to code the validation in the itemchanged event of the datawindow control. Here you can decide what action to take when there is an error in the entered data. For specifics on return codes of the event look in the online help of PowerBuilder. On Mon, 2...

Form field with validation still lets user submit form with empty value...
I have a text box that a user is to enter a quantity.  I have validation working so that they have to enter an integer, however, the form will still submit if the text box for quantity is left blank.  The field isn't required, so how do I check to make sure that the user doesn't submit a blank value on top of making sure they enter an integer?  This is what I have so far... <asp:TextBox ID="SpclBioQty" runat="server" Columns="5" Width="33px"></asp:TextBox><asp:CompareValidator ID="SpclBioQtyValidator" ru...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

Set TextBox text value to value from DataList Control
I'm sure this is a totally sad question to ask, but... I am using a DataList View to display data. I have a separate form within a LoginView that I would like to use to update a few main fields. I want to set the Text property of the TextBox in my custom edit form to the value of the corresponding field in the DataList. Is this possible? I think i get your question --> you want the text from a  textbox from the datalist to be input into a textbox within your form? try:TextBox tb = DataList1.FindControl("TextBoxIDToFind"); TextBoxOnForm.Text = tb.Text;David Ki...

Setting the Parameter Value to the Property Value of a Web Control
I want to filter my DetailsView with a declarative parameter. In my case, I am setting the SqlDataSource's parameter values based on the value of 2 TextBox controls on the page. I have a SP that does a SELECT based on 1 of the parameters passed in (either an ID or phone number). Param Name          Value MemberID          TextBox1.Text Phone               TextBox2.Text I want to assign a default value of 'null' for b...

Drop down list in Form view returns error when value in bound field (data binding
I get the following error when I click edit to edit the details in the web form:'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value  I would like it to accept any value which currently exists in the database. Is this easily achievable? With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.~ Timwww.bucketo...

cascading dropdown set it's value only once but not on subsequent postbacks,web service recieve the value but can't set in dropdown
i have a dropdown named uxcommunity which is a dropdown and contain text in format ##-####-#### . and 2 more dropdowns province and district where province filters district. i get the first 2 characters ##  for session("province") and #### for session("District") and i have button to do the postback. first when the form loads and i click the button it get the value and select appropraite items in to dropdown province and district. but when i change the province dropdown content and district dropdown content and click the button , session will take correct...

Not able to retreive value in text box which is read only and is assigned as a control to validate in Required Field Validator
Dear All, Please help me to find a solution for this, it is a bug when the following condition is there. I have a text box which is getting some values say [Employee name] from a popup window which is open, after binding the values to the text box, the popup dissappears [javascripts are written for this]. Till here it is okey Basically the text box is readonly, and it is assigned as a control to validate control with a required field validator contol. Now When ever some event [server event] occurs  I am not able to retrieve the value inside the text box. The value in the text box d...

Not Able to Retrieve Value in A Text box if it is Read only and is assigned as control to validate with Required Field Validator
Dear All, Please help me to find a solution for this, it is a bug when the following condition is there. I have a text box which is getting some values say [Employee name] from a popup window which is open, after binding the values to the text box, the popup dissappears [javascripts are written for this]. Till here it is okey Basically the text box is readonly, and it is assigned as a control to validate control with a required field validator contol. Now When ever some event [server event] occurs  I am not able to retrieve the value inside the text box. The value in the text ...

If Not value or value then....
Hi all,I want to write a simple IF Not then statement in ASP.net 2.0 and I would like some help please.  If Not ntuser = "DOMAIN\ntuser" Or ntuser = "DOMAIN\ntuser2" Then Panel1.Visible = False End If Doesnt work, can you tell me where i'm going wrong please?many thanks.  The first place you're going wrong is in telling us it "doesn't work" without providing any details. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. Use Not as stated below. It ...

Web resources about - Issue: Valid login values persist regardless of how I set field .Text values - asp.net.web-forms

Speck Pocket VR viewer case is a durable, foldable Google Cardboard replacement
Mobile virtual reality on our smartphones is one of the newer technologies that's sure to take off in 2016, and while Google has already come ...

Eric Boehlert: The Media's Missing Context: Obama's Push To Expand Background Checks Is Wildly Popular ...
After President Obama unveiled new executive orders aimed at reducing gun violence, a constant media theme has been that the proposals are deeply ...

Josh Duggar Files Motion To Dismiss Lawsuit, Says Adult Film Star Has No Proof
Josh Duggar has made a motion to dismiss Danica Dillon’s lawsuit claiming she was the victim of battery during their alleged sexual encounters. ...

Twitter Expanding Character Limit To 10,000, CEO Jack Dorsey Wants An Edge Over Facebook
Twitter may be expanding its message character limit from 140 to 10,000. Should the change happen, it would be another effort by the social media ...

Asylum applications to the UK more than double in ten months to 5,095 – the highest figure for 6 years ...
Asylum applications to the UK more than double in ten months to 5,095 – the highest figure for 6 years – but are still below other EU countries ...

'Making a Murderer' filmmakers say a juror believed defendant was innocent
wtkr.com 'Making a Murderer' filmmakers say a juror believed defendant was innocent wtkr.com A member of the jury that declared Steven Avery ...

Oculus Rift Headset Priced At $599 For Consumers, Ships In March
It’s been a long wait but the price-tag for the consumer version of the Oculus Rift virtual reality headset has finally been confirmed now that ...

Video Distribution Startup VHX Is Now Building Apps For Phones, Tablets And Internet-Connected TVs
VHX, a startup that helps customers sell videos online, is taking a big leap into mobile, with new capabilities for publishers to launch their ...

Opinion: Apple cuts iPhone manufacturing?
Roll up, roll up for the amazing post-Christmas Apple -FUD-frenzy as weird tales claiming it has cut iPhone production spread. Buy on rumor ...

Iraq offers to mediate between Saudi Arabia, Iran
TEHRAN, Iran (AP) — Iraq on Wednesday offered to mediate between Saudi Arabia and Iran after tensions soared following the kingdom's execution ...

Resources last updated: 1/6/2016 4:55:56 PM