+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Sitefinity 4.0 rc integration with Silverlight existing project

Sitefinity 4.0 rc integration with Silverlight existing project

13 posts, 0 answered
  1. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    22 Nov 2010
    Link to this post
    Hello,
    we've got an existing silverlight applicazion and we need to open in a tab using a SL RadHtmlPlaceholder a sitefinity project... we also need to pass asp.net membership credential of the user that has logged in in the silverlight application to the sitefinity without using a login form... how can we achive this?
    Thanks

    Paolo
  2. Hristo Borisov
    Hristo Borisov avatar
    190 posts
    Registered:
    18 Nov 2016
    22 Nov 2010
    Link to this post
    Hello Paolo,

    Opening Sitefinity in RadHtmlPlaceholder should be as simple as setting the url of the project to be opened in the placeholder. As far as concerning the authentication to Sitefinity 4.0, I am attaching a sample console application that uses the RESTful services of Sitefinity in order to authenticate the user to the system. You can easily integrate the code to work with your Silverlight application.

    Thank you for contacting us and we look forward to receiving your early feedback about Sitefinity.

    Regards,
    Hristo Borisov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    23 Nov 2010
    Link to this post
    Hello Hristo,
    thanks for your sample.. just one question, with this method I should re-validate the user even it is' currently logged in the silverlight application, am I right? if I pass my own membership provider (the one I use in my SL application) should it just verify it's authenticated?
    Thanks

    Paolo
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    23 Nov 2010
    Link to this post
    Hi Paolo,

    The code just authenticates a user with the provided credentials. If the user is logged in Sitefinity you will get an message that the user is already logged in from another address.

    If you have a custom provider for your application you need to add it to Sitefinity and pass its name as membershipProvider parameter in the AuthenticateRequest

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    23 Nov 2010
    Link to this post
    Hello Ivan,
    maybe I've not explained well myself... sorry for that, I wish to only authenticate in the SL application and share the ASP.NET authentication ticked with Sitefinity 4 (I'll find some way to tell SF wich is the role of the user)
    Thanks
  6. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    25 Nov 2010
    Link to this post
    Hello Ivan,
    where should I handle the AuthenticateRequest event?? I'm new to Sitefinity and need to provide a demo with this authentication in a week.... for now I'm able to load the Sitefinity in a radhtmlcontainer but it asks me for logging in...
    Thanks

    Paolo
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    01 Dec 2010
    Link to this post
    Hello Paolo,

    AuthenticateRequest is a function of the code we sent you. The code uses Users service to pass your credentials.

    You have to set the following parameters

               // Credential information
                var membershipProvider = ""; // Means default configured.
                var userName = "admin";
                var password = "password";
                var rememberMe = true;

    I verified the code and it works properly.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    02 Dec 2010
    Link to this post
    Hello Ivan,
    I've read your code and tried to adapt it in a SL enviorment but I've got no sync event so I need to adapt the

    private static string InvokeWebMethod(string serviceUrl, string methodName, string httpMethod, byte[] data)
      {
          // Create and set the request object
          var request = (HttpWebRequest)WebRequest.Create(String.Concat(sitefinityHost, serviceUrl, methodName));
          request.Method = httpMethod;
          request.ContentType = "application/json";
          request.CookieContainer = new CookieContainer();
          // Add cookies if there are any
          if (cookies != null)
          {
              foreach (Cookie cookie in cookies)
                  if (!cookie.Expired)
                      request.CookieContainer.Add(cookie);
          }
          if (data != null)
          {
              request.ContentLength = data.Length;
              // Send the data to the request stream
              using (var writer = request.GetRequestStream())
              {
                  writer.Write(data, 0, data.Length);
              }
          }
          // Invoke the method and return the response.
          using (var response = (HttpWebResponse)request.GetResponse())
          {
              // Store the cookies from the response for the current session.
              cookies = response.Cookies;
              // Read the response
              using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
              {
                  return reader.ReadToEnd();
              }
          }
      }

    and do it in an async way... consider I'll need to authenticate different users and not just login as administrator...
    can you please help me on this?
    Thanks
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Dec 2010
    Link to this post
    Hello Paolo,

    You should be able to use the code witch every user that has an access to the website. The "admin" is just a sample in the code. You can switch all parameters depending on your needs. You cannot authenticate two users from one machine, because if you are logged in and try to authenticate another user this will log out the first user, because the cookie is in the browser. If you use this code on two machines withtwo different users there would not be a problem.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Devendra
    Devendra avatar
    3 posts
    Registered:
    21 Feb 2011
    23 Feb 2011
    Link to this post
    Hello Ivan,

     I also have same requirement .The use case we are trying to achieve for now is one where an authenticated user in our healthcare application clicks the forums or blogs/articles menu from  our healthcare application  and they switch over to SiteFinity.  The tricky part will be the seem less or hidden authentication that takes place on the SiteFinity side.   The user should not see a login when they switch over to SiteFinity.

    Please suggest me possible ways with some sample codes

    Thanks & Regards
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    23 Feb 2011
    Link to this post
    Hello,

    The code in the post will generate authentication and role cookie and you will not be require to type your credentials.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
  12. Devendra
    Devendra avatar
    3 posts
    Registered:
    21 Feb 2011
    23 Feb 2011
    Link to this post
    Hello Ivan,

    Yes the code u posted is authenticating the user. but my scenario is something different
    When a user register in my application than he should get registered in Sitefinty Website by using Sitefinity service
    and when he log in to my website than he should get links of blogs and forms
    by clicking them user should redirect to the sitefinty website without showing login page(internally authenticated process) ..So now user can see his own blogs and forms in Sitefinity  Website

    Thanks & Regards

  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    28 Feb 2011
    Link to this post
    Hi Paolo,

    Since the code above generates Roles and authentication cookie you should be able to access the secured parts of your website. Generally you need to make two requests 1 - to authenticate the user and second to request the secured area.

    Regards,
    Ivan Dimitrov
    the Telerik team
13 posts, 0 answered