0
所有我试图做的是创建一个登录控件,我想放在我的主页。MVC部分登录控制
香港专业教育学院创建了一个登录用户控制如下:
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of MyWebsite.LogOnModel)" %>
<% Using Html.BeginForm() %>
<%: Html.ValidationSummary(True, "Login was unsuccessful. Please correct the errors and try again.")%>
<div>
<div class="editor-label">
<%: Html.LabelFor(Function(m) m.UserName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(m) m.UserName) %>
<%: Html.ValidationMessageFor(Function(m) m.UserName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(m) m.Password) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(Function(m) m.Password) %>
<%: Html.ValidationMessageFor(Function(m) m.Password) %>
</div>
<div class="editor-label">
<%: Html.CheckBoxFor(Function(m) m.RememberMe) %>
<%: Html.LabelFor(Function(m) m.RememberMe) %>
</div>
<p>
<input type="submit" value="Log On" />
</p>
</div>
<% End Using %>
我比家里的Index.aspx页面上呈现这样的:
Html.RenderPartial("UsrCtlLogin")
它正确地显示了在主页上。但我的问题是我如何将它连接到AccountController逻辑。即在点击登录时,我希望它激发LogOn http方法并验证用户(如果提供了无效详细信息,则显示无效消息),并且如果它们成功,则将它们重定向到页面。
如何创建用户控件和AccountController之间的链接?
在此先感谢