Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports Microsoft.Owin.Security
Partial Public Class Account_Login
Inherits Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
RegisterHyperLink.NavigateUrl = "Register"
OpenAuthLogin.ReturnUrl = Request.QueryString("ReturnUrl")
Dim returnUrl = HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
If Not [String].IsNullOrEmpty(returnUrl) Then
RegisterHyperLink.NavigateUrl += "?ReturnUrl=" & returnUrl
End If
End Sub
Protected Sub LogIn(sender As Object, e As EventArgs) Handles btnLogin.Click
If IsValid Then ' Validate the user password
Dim manager = New UserManager()
Dim user As ApplicationUser = manager.Find(username.Text, password.Text)
Try
If user IsNot Nothing Then
IdentityHelper.SignIn(manager, user, RememberMe.Checked)
IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response)
End If
Catch ex As Exception
FailureText.Text = ex.Message
ErrorMessage.Visible = True
End Try
End If
End Sub
End Class
No error message is generated but when I complete the log-in form nothing happens after I press the Submit button.
When the user logs in and his credentials are validated against the database, the form should ideally disappear and
the user is sent to a Classic ASP Web site already on the WWW. That is, that particular Web site is not part of this small ASP.NET project whose pages will be 'sellotaped' onto that Classsic ASP site. (Eventually, I may try to do that site in ASP.NET but it would be too ambitious for me to try it now.)
How would I code that in my Login.aspx.vb file, or add to the script above, because in the script above there is no reference to a URL path as in 'when you click
on the Go/Submit button, make this log-in form disappear, and take me to www.mysite.com'?
Thanks for reading.