I am facing a strange problem here. I have two projects, each of them has some webpages.
Initially i did not attempt User Account Creation and Login. However i just wanted to be able to start a process on a Button Click Event which worked fine.
However in my new project [where i have used User Login], i simply am not able to create any handlers, here is my code for the page its not working:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site1.master" AutoEventWireup="true"
CodeBehind="~/Default.aspx.cs" Inherits="Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<style type="text/css">
.style1
{
width: 100%;
background-image: url('../Images/dl.jpg');
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" >
<h1>
<span class="input">Welcome to the members-only page.</span>
</h1>
<h2>
Start Client Side Application.
</h2>
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<span class="input"> You are not logged in. Click the Login link to sign in</span>
</AnonymousTemplate>
<LoggedInTemplate>
<span class="input">You are logged in. Welcome, </span>
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName ID="LoginName1" runat="server" />
<table class="style1">
<tr>
<td align="center" valign="middle">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Click on This Image Link To Start The Application<br />
<br />
<asp:ImageButton runat="server" ID="ImageButton1" Height="100px"
ImageUrl="~/Images/rdi.jpg" />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</td>
</tr>
</table>
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="RedirectToLoginPage" BackColor="White"
Font-Underline="True" />
</asp:Content>
What is the workaround for this? In fact i just noticed that the event handlers work for another webpage within the same project but not this one.
Sometimes (although rarely) the auto-generated “aspx.designer.cs” file can cause strange issues in the code-behind. Have you looked at this file to see if the controls included match your page defined controls?
If you think this could be the issue you can delete and recreate the designer file. If you’ve never deleted a designer file before, this might be a bit frightening, but the designer file is auto-generated and merged with the partial class in the aspx.cs code-behind file. Basically, this file is used to auto-generate the definition for the WebControls on the page.
Here’s a link i found quickly when searching: http://www.undermyhat.org/blog/2009/07/tip-regenerate-aspx-designer-cs-files-when-corrupted/
To delete and recreate the Default.aspx.designer.cs: