Use ASP.NET Membership in ServiceStack
Asked Answered
E

2

5

how can i use asp.net membership in ServiceStack ? (ServiceStack.OrmLite , ServiceStack.Host.AspNet , etc )

Eductive answered 3/1, 2012 at 11:15 Comment(0)
D
7

You can host ServiceStack on a custom path, i.e. at /api which lets you run ASP.NET web forms and ServiceStack side-by-side and then use the normal ASP.NET membership provider in ASP.NET.

You can then share UserSessions with ServiceStack using its Session Provider, here's an example on how to instantiate a Session with MVC - you can use this same class with ASP.NET.

The alternative is to forgo the ASP.NET membership provider and just stick to the built-in authentication in ServiceStack. It includes support for Credentials (i.e. user/pass - what you want) but also Twitter / Facebook / BasicAuth + your own. With In-Memory, OrmLite and Redis backends.

Here's an example website of using all authentication options in the same ServiceStack app with an OrmLite backend.

Dwell answered 3/1, 2012 at 17:11 Comment(3)
how can i use CredentialsAuthProvider for implementing login form ? is it possible for you to introduce a simple - and not a complicated - sample ?Eductive
See the example demo at: bootstrapapi.apphb.com and its source code at github.com/ServiceStack/SocialBootstrapApiDwell
404 on the instantiate a Session with MVC linkErmin
A
2

If you want to use membership, and want to use the ORM lite with the membership framework (although you could still use the SqlMembershipProvider), you can create a custom provider class like so:

public class ServiceStackMembershipProvider : MembershipProvider
{

}

And implement all the methods (or at least the methods you need) using the ORM components.

Adorl answered 3/1, 2012 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.