Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What this code is for? 1

Status
Not open for further replies.

A1Pat

IS-IT--Management
Jun 7, 2004
454
US
Hi all,

I'm doing a modification on a given example code by adding another TextBox and Label into its form, but it keeps return an error asking me for this line which is located on way top of the page's code:

<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="CamAccess.WebForm1" %>

I cannot fine any page namely "Login.aspx.cs" or something likes that anywhere in the folder of the site, can someone tells me what is that code for?

Thanks!
 
For more completion of the page, this is the whole page's code for your review:

Code:
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="CamAccess.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Surveillance Login</title>
		<meta name="vs_showGrid" content="False">
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5">[/URL]
	</HEAD>
	<body MS_POSITIONING="GridLayout" bgColor="#3366cc">
		<form id="Form1" method="post" runat="server">
			<DIV style="PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 16pt; Z-INDEX: 102; LEFT: 56px; VERTICAL-ALIGN: baseline; WIDTH: 312px; COLOR: #ffffff; PADDING-TOP: 2px; FONT-FAMILY: 'Microsoft Sans Serif'; POSITION: absolute; TOP: 48px; HEIGHT: 32px; BACKGROUND-COLOR: #0000cc"
				ms_positioning="GridLayout">Surveillance Sign-In</DIV>
			<DIV style="Z-INDEX: 101; LEFT: 56px; WIDTH: 312px; POSITION: absolute; TOP: 80px; HEIGHT: 123px; BACKGROUND-COLOR: lightgrey"
				ms_positioning="GridLayout">
				<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 16px" runat="server"
					Width="89px" Font-Bold="True">Username</asp:Label>
				<asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute; TOP: 48px"
					runat="server" ErrorMessage="Password is Required" ControlToValidate="Password">*</asp:RequiredFieldValidator>
				<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 48px" runat="server"
					Width="89px" Font-Bold="True">Password</asp:Label>
				<asp:TextBox id="Username" style="Z-INDEX: 104; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"></asp:TextBox><INPUT id="Password" style="Z-INDEX: 105; LEFT: 120px; WIDTH: 153px; POSITION: absolute; TOP: 48px; HEIGHT: 22px"
					type="password" size="20" name="Password1" runat="server">
				<asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX: 106; LEFT: 288px; POSITION: absolute; TOP: 16px"
					runat="server" ErrorMessage="Username is Required" ControlToValidate="Username">*</asp:RequiredFieldValidator>
				<asp:Button id="bLogin" style="Z-INDEX: 107; LEFT: 216px; POSITION: absolute; TOP: 80px" runat="server"
					Width="56px" Text="Login"></asp:Button></DIV>
			<asp:ValidationSummary id="Summary" style="Z-INDEX: 107; LEFT: 376px; POSITION: absolute; TOP: 96px" runat="server"
				Width="208px" Height="56px" DisplayMode="List" BorderStyle="Solid" BorderWidth="1px" BorderColor="Gold"
				BackColor="#FFFF80"></asp:ValidationSummary>
			<asp:CustomValidator id="LoginFailed" style="Z-INDEX: 108; LEFT: 88px; POSITION: absolute; TOP: 216px"
				runat="server" ErrorMessage="Login Failed.<BR/>Check spelling and try again." Visible="False"></asp:CustomValidator>
		</form>
	</body>
</HTML>
 
Whoever wrote the code is using the codebehind of another page for this page. This is valid, the problem is, you need to find the Login.aspx.cs file.
 
I exampled the form on this page and see no redirect of script to process the input username nor password anywhere, do you think the hidden Login.aspx.cs page do this job?
 
There is nothing hidden, that aspx file is looking for a specific .cs file which you need to find in order for it to work properly.
 
this is very weird!!!

I found a page namely Default.aspx.cs that corresponses to this page Default.aspx but nowhere I can find this particular page Login.aspx.cs in the same folder; and yet, the site seems to work ok anyway. This's pulling my hair!!!

Thanks, I'll come back to you when I find this page and having more question about it. Later!
 
Well, it is possible that the file has been moved or deleted. It may work right now because when the project was compiled, the login.aspx.cs file was there (thus compiled into the working .dll). But has since been moved. Make sense?

If you can't find the code, a last resort could be to use Reflector for .NET to disassemble the code and copy and paste the code from the old login.aspx.cs into a new one that you create.

Ron Wheeler
 
Thank you ninjadeathmonkey for providing me a very good idea to solve my problem; however, I download the code but found no instruction on how to utilize it anywhere. Could you show me how to disassemble using the Reflector as well...

Thank you in advanced!
 
Here is the step by step process:

[ol]
[li]Open up Reflector.exe[/li]
[li]Click File > Open (and select the .dll from the web site)[/li]
[li]Expand out the Assemby (in your case "CamAccess")[/li]
[li]Expand CamAccess.dll (if that is the dll name)[/li]
[li]Expand "{} CamAccess" and select "login".[/li]
[li]Click on Tools > Disassemble.[/li]
[li]When you expand "login", you can click on each method to see what the code is. [/li]
[li]Then just copy and paste it into the login.aspx.cs that you created (create it if you haven't yet)[/li]
[/ol]

Hope that helps!

Ron Wheeler
Tekdev Open Source Development
 
Thank you Ron, that helps alot!!!!

I don't see the login page anywhere, but by clicking around, I'd be able to see a WebForm1 expansion and viewed how and where the login took me to. But it's not called login and I don't know whether it is the login.aspx.cs page... any idea?
 
By the way, by reading again, I can see this

<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="CamAccess.WebForm1" %>

Inherits="CamAccess.WebForm1"... Am I on the right track here? If I am, should I copy the code then save it the a file namely Login.aspx.cs, and save the file to the same directory as it should be?
 
Thank you very much for the help, keep up the good work!!! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top