views:

66

answers:

2

I have made a web application that uses master page for Login & Logout operation. For that purpose, I have used LoginStatus control in master page provided by ASP.NET. However, LoginStatus control needs to be used inside <form> tag as

<form id="form1" runat="server">
<asp:LoginStatus ID="LoginStatus1" runat="server" />
</form>

My Content pages has Login control or New User (Signup) control, for logging in or new user creation. These too requires to be enclosed in <form> tag.

So in these pages, there appears to be two ASP.NET forms with runat="server".

  1. Form for LoginStatus in Master page
  2. Form for Login control in Content pages

ASP.NET does not allow to have 2 forms simultaneously. One solution is to make one form hidden, but it cannot be applied in this case.

I tried to enclose entire page within one ASP.NET form tag so that LoginStatus & Login/Signup control comes under a single form tag, but then neither Login nor Signup works, because these controls require for themselves, a seperate form tag.

So how shall I proceed or what changes I need to make both the controls work simultaneously?

+1  A: 

That is a common use case scenario. There must be some thing not quite right with your masterpage/content page setup.

Here is a working project that does what you ask.

Sky Sanders
A: 

As Sky Sanders mentioned above, this is a very common scenario. The usual setup is having the tag in the Master Page and not in the content pages. Please post your code and/or error message if still fails.

Ricardo