473,404 Members | 2,187 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,404 software developers and data experts.

Help With Hardcoding Username And Password For Testing

I am trying to test with a hard coded username and password and I do not know how to put them in my code. For example say I want my username to be mary and password to be pass for testing purposes.

I thought it would be : txtPassword = "pass" txtUsername = "mary"

but that doesn't work.

help please..

Here is my code:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>BID</title>
</head>
<body>


<span style="font-size: 16pt; color: teal;">
<asp:Image ID="Image1" runat="server" ForeColor="Silver" Height="128px" ImageUrl="~/IMAGES/wvdo_logo.gif"
Width="320px" /><br />
<br />
<br />
Welcome to the Project Development Department of the West Virginia Development Office.
<br />
<br />
Please enter your username and password.</span>

<form id="Form1" runat="server">
<table style="width: 504px">
<tr>
<td style="width: 111px; height: 28px">
<asp:Label ID="lblUsername" runat="server" Height="24px" Width="104px" Font-Bold="True" ForeColor="#8080FF" >USERNAME:</asp:Label>&nbsp;
</td>
<td style="width: 211px; height: 28px">
<asp:TextBox ID="txtUsername" runat="server" Width="136px" />
<asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="Please enter your Username" ControlToValidate="txtUsername" Display="Dynamic" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px; height: 28px">
<asp:RegularExpressionValidator ID="revUsername" runat="server" ControlToValidate="txtUsername"
Display="Dynamic" ErrorMessage="Your Username is invalid"></asp:RegularExpressionValidator></td>
</tr>

<tr>
<td style="width: 111px">
<asp:Label ID="lblPassword" runat="server" Font-Bold="True" ForeColor="#8080FF" Text="PASSWORD:"
Width="104px"></asp:Label></td>
<td style="width: 211px">
<asp:TextBox ID="txtPassword" runat="server" Width="136px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Please enter your password" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px">
<asp:RegularExpressionValidator ID="revPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Your password must be at least 4 characters long"
ValidationExpression=" \w{4,}"></asp:RegularExpressionValidator></td>

</tr>
</table>
&nbsp;<br />
&nbsp; &nbsp; &nbsp;&nbsp;<br />
<asp:Button ID="btnSubmit" runat="server" Font-Bold="True" Text="Submit" PostBackUrl="~/projectdevelopmentmain.aspx" /><br />
&nbsp; &nbsp;&nbsp;&nbsp;<br />
<asp:HyperLink ID="hprMainMenu" runat="server" Font-Bold="True" Width="88px" NavigateUrl="~/mainpage.aspx">Main Menu</asp:HyperLink><br />
<br />
<br />
</form>
</body></html>


THANK YOU!!!!
Oct 22 '07 #1
12 2746
Plater
7,872 Expert 4TB
Where you have:
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="txtUsername" runat="server" Width="136px" />
  2.  
Add in the Text part?
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="txtUsername" runat="server" Width="136px" Text="MyUsername" />
  2.  
Oct 22 '07 #2
Where you have:
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="txtUsername" runat="server" Width="136px" />
  2.  
Add in the Text part?
Expand|Select|Wrap|Line Numbers
  1. <asp:TextBox ID="txtUsername" runat="server" Width="136px" Text="MyUsername" />
  2.  


THANK YOU SO MUCH FOR YOUR QUICK REPLY but I get an error.


Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The tag contains duplicate 'Text' attributes.

Source Error:


Line 44: <tr>
Line 45: <td style="width: 111px">
Line 46: <asp:Label ID="lblPassword" runat="server" Font-Bold="True" ForeColor="#8080FF" Text="PASSWORD:"
Line 47: Width="104px" Text="pass" /></asp:Label></td>
Line 48: <td style="width: 211px">


Source File: /WVDODevSite/projectdevelopment.aspx Line: 46


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
Oct 22 '07 #3
Maybe I typed the wrong thing, I don't mean hard coded like it always being there I mean like that is the username and password it accepts.
I hope you understand.

thanks
Oct 22 '07 #4
Plater
7,872 Expert 4TB
Ohh haha ok (and you got that error because you put it in the LABEL object which already had a TEXT that gets displayed as like "Password:")

Well where you plan to validate that username/password, add in a special case so that:
[code]
if ((txtPassword.Text="mypassword") &(txtUsername.Text="myusername"))
{//your special case username and password are correct
}
Oct 22 '07 #5
hmmm, thank you but I am still having problems.


I put the code in but that actual code shows up on my page:



<form id="Form1" runat="server">
<table style="width: 504px">
<tr>
<td style="width: 111px; height: 28px">
<asp:Label ID="lblUsername" runat="server" Height="24px" Width="104px" Font-Bold="True" ForeColor="#8080FF" >USERNAME:</asp:Label>&nbsp;
</td>
<td style="width: 211px; height: 28px">
<asp:TextBox ID="txtUsername" runat="server" Width="136px" Text="mary"/>
<asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="Please enter your Username" ControlToValidate="txtUsername" Display="Dynamic" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px; height: 28px">
<asp:RegularExpressionValidator ID="revUsername" runat="server" ControlToValidate="txtUsername"
Display="Dynamic" ErrorMessage="Your Username is invalid"></asp:RegularExpressionValidator></td>
</tr>


<tr>


if ((txtPassword.Text = "pass") & (txtUsername.Text = "mary"))


<td style="width: 111px">
<asp:Label ID="lblPassword" runat="server" Font-Bold="True" ForeColor="#8080FF" Text="PASSWORD:"
Width="104px"/></asp:Label></td>
<td style="width: 211px">
<asp:TextBox ID="txtPassword" runat="server" Width="136px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Please enter your password" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px" Text="pass">
<asp:RegularExpressionValidator ID="revPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Your password must be at least 4 characters long"
ValidationExpression=" \w{4,}"></asp:RegularExpressionValidator></td>

Am I putting it in the right spot??
Thank you so much!!!
Oct 23 '07 #6
radcaesar
759 Expert 512MB
As of Plater's reply u have to use that in Codebehind file not in aspx file.
Oct 23 '07 #7
thanks.

oh gosh like a vb file or something? I am new at this and have no idea what you mean by code behind. I had a vb.net class last week and he ended up with a vb file, but I am not sure how to do it.

thank you for your reply.
Oct 23 '07 #8
radcaesar
759 Expert 512MB
Yes Exactly, Its aspx.vb file

:)
Oct 23 '07 #9
Plater
7,872 Expert 4TB
If you are working in visual studio (or visual web express) the solution explorer should have files already created for you where you can enter this type of code.
Oct 23 '07 #10
kenobewan
4,871 Expert 4TB
Why not store them in the web.config and use them in the aspx.vb via cofiguration appsettings? Sorry but if this is your test design it is unlikely to be a secure application :(.
Oct 23 '07 #11
plater---- For some reason files I created without visual studio didn't have the extra vb files when I opened it up in visual studio.

I am just learning this stuff and there is so much to learn.
I am reading about the code behind and I think I am finally starting to get it.
thanks for all yoru help.



kenobewan---

I have no idea what you are talking about right now. haha
I am so new at this.. I think I might have an idea if I remember something from class but right now it just isn't coming to me.

Sometimes I wonder if I am the only one that has so much trouble learning this stuff. Seems like I am the only one that starts at the beginning..
How did you guys learn this stuff??

thanks for all your help.
Oct 23 '07 #12
kenobewan
4,871 Expert 4TB
Keep learning, pressure plus time equals evolution. Good thing that you are doing a course, better to learn best practices - saves time. I find you struggle in the dark until suddenly you see the light. If are impatient this is probably not the job for you. Remember that you are always wrong until the code is proven wrong. If its enlightenment you seek understand this, the exception proves the rule.

As to your coding problems, I believe that you already have enough advice from the experts to solve them. If you seek the easy road now, always copying and pasting, you may never see the light. I dont believe anyone becomes an expert in a week. All the best!
Oct 25 '07 #13

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

Similar topics

7
by: Mike | last post by:
I've been trying for the past week to put a simple code together. I have done a LOT of searching, found scripts showing the functions I would like to use, however when I mix them it all goes wrong,...
1
by: A Hirsi | last post by:
I have created a vb .net program as a service that is using a simple ftpclient to connect to a remote server and check the status of a file for subsequent downloading if there have been changes to...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
2
by: dalsoth | last post by:
Hi Guys I have created a website and to makes things easier i decided to use dreamweaver to do the secure login section and access levels for the pages. When testing locally on wamp my website...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
13
by: thetechturf.com | last post by:
Ok, here's the deal. I need a script written that will: Use a regular HTML page and form (I plan to have this in a small box on all my HTML pages) to submit the information: Username and...
2
by: muchexie | last post by:
i have two scripts that are not running to reset a password that has been forgotten and the other to change old password. here are the scripts. change_passwd.php session_start();...
3
by: Charlotte | last post by:
Hello, info: I'me a rookie with IIS I have on a WinXP Pro the IIS installed, so I can test some pages before uploading to the hostserver online on the hostserver is a possibility (with the...
13
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.