开发者

Multiple ASP.NET forms for authentication

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 w开发者_StackOverflow中文版orks, 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜