I basically need to login into another domain that is using asp.net membership.
If we have an ASP.net web application using ASP.Net Membership on one hand, and an HTML page from another domain on the other hand.
Is it possible to login into the ASP.NET website via remote HTML page.
I've done this with Coldfusion before but ASP.NET membership is using a server control.
Cheers!
Underneath the Login Server Control, ASP.NET uses a MembershipProvider implementation and Forms Authentication to a user in with ASP.NET Membership. You can replicate these steps without using the Login Server Control, by manually validating the credentials and then attaching the
FormsAuthentication
cookie to theResponse
.Here are some resources that should help you get started:
You would also probably benefit from Reflecting on the source of the
Login
control, so you can gain an understanding the exact sequence of events that happens when a user logs in using the server control. This should make it easier for you to understand how to replicate that functionality for your particular use case.As a side-note, I would recommend using a custom
IHttpHandler
implementation as an injection point for processing the login request, but there are many ways you can accomplish this task.Update, I'm feeling generous, so
Below is an example handler that you could use to log a user in with ASP.NET Membership and FormsAuthentication (just like the server control).
This code assumes:
The requesting page has a form that points to the url/route that is mapped in the web.config or with routing, and that the form on that page contains a
username
input field with the nameusername
and apassword
input field with the namepassword
.