You could use AJAX to call the membership services in order to authenticate the user:
You would need to enable the AuthenticationServices in the web.config file
<configuration>
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCaching="false" enableCompression="false" />
<webServices>
<authenticationService enabled="true" requireSSL="false" />
</webServices>
</scripting>
</system.web.extensions>
</configuration>
And then in a page:
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server" ID="sm">
</asp:ScriptManager>
<asp:LoginView runat="server">
<AnonymousTemplate>
<input type="tel" name="user" id="user" />
<br />
<input type="password" name="pass" id="pass" />
<br />
<input type="button" value="Login" name="login" id="login" onclick="attemptLogin(this);" />
</AnonymousTemplate>
<LoggedInTemplate>
<input type="button" name="logout" id="logout" value="Logout" onclick="attemptLogout(this);" />
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName FormatString="Welcome {0}!" runat="server" />
<%--<asp:LoginStatus runat="server" />--%>
</div>
<script>
function attemptLogin(e) {
Sys.Services.AuthenticationService.login(
$get("user").value,
$get("pass").value,
false,
null,
null,
function success(validCredentials, userContext, methodName) {
if (validCredentials == true) {
alert("user logged in");
window.location = window.location;
}
else {
alert("user name or password incorrect");
}
}, function fail(error, userContext, methodName) {
alert(error.get_message());
}, null);
}
function attemptLogout(e) {
Sys.Services.AuthenticationService.logout(
window.location,
null,
null,
null
);
}
</script>
</form>
Alternatively, you could expose a web service with the login logic and call that web service instead of the AuthenticationService using AJAX
Another way would be to create a UserControl with the login controls and put that control on the home page handling the login events in the UserControl's code behind