More in this section

Forums / Developing with Sitefinity / sitefinity membership

sitefinity membership

2 posts, 0 answered
  1. developer
    developer avatar
    13 posts
    11 Feb 2013
    14 Feb 2013
    Link to this post

    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?

  2. Dave
    Dave avatar
    22 posts
    05 Nov 2012
    14 Feb 2013
    Link to this post


    I went off of the blog post by the falafel folks.

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

    module main
    open System.Net
    let credentialsFormat =  @"
    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)
    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. 


2 posts, 0 answered