sitefinity membership

Posted by Community Admin on 04-Aug-2018 11:38

sitefinity membership

All Replies

Posted by Community Admin on 14-Feb-2013 00:00

I create some users and set them role in sitefinity. I writed a login usercontrol. I'd like to validate password and username in code behind. How to do this? can you give me some c# example code?

Posted by Community Admin on 14-Feb-2013 00:00

Hi, 

I went off of the blog post by the falafel folks. blog.falafel.com/.../using-sitefinity-5-claims-authentication

Here's the fsharp code I use to access the authentication service

module main
open System.Net
 
let credentialsFormat =  @"
        
            ""MembershipProvider"":""0"",
            ""Password"":""1"",
            ""Persistent"":2,
            ""UserName"":""3""
        "
 
let json = System.String.Format(credentialsFormat, "Default", "password", true ,"user")
let credentials = System.Text.Encoding.UTF8.GetBytes(json)
let webRequest = HttpWebRequest.Create(@"http:/<siteurl>/Sitefinity//Sitefinity/Services/Security/Users.svc/Authenticate");
webRequest.Method <- "Post"
webRequest.ContentType <- "application/json"
webRequest.ContentLength <- int64(credentials.Length)
 
 
[<EntryPoint>]
let main argv =
    let reqStream = webRequest.GetRequestStream().Write(credentials,0,credentials.Length)
    use response = webRequest.GetResponse() :?> HttpWebResponse
    let stream = response.GetResponseStream();
    printfn "%A" stream

    printfn "%A" argv

I'm not super great at sitefinity so someone may have a better answer for you. 

Dave

This thread is closed