Sitefinity 4.0 rc integration with Silverlight existing proj

Posted by Community Admin on 03-Aug-2018 13:06

Sitefinity 4.0 rc integration with Silverlight existing project

All Replies

Posted by Community Admin on 22-Nov-2010 00:00

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

Posted by Community Admin on 22-Nov-2010 00:00

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

Posted by Community Admin on 23-Nov-2010 00:00

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

Posted by Community Admin on 23-Nov-2010 00:00

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

Posted by Community Admin on 23-Nov-2010 00:00

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

Posted by Community Admin on 25-Nov-2010 00:00

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

Posted by Community Admin on 01-Dec-2010 00:00

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

Posted by Community Admin on 02-Dec-2010 00:00

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

Posted by Community Admin on 02-Dec-2010 00:00

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

Posted by Community Admin on 23-Feb-2011 00:00

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

Posted by Community Admin on 23-Feb-2011 00:00

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

Posted by Community Admin on 23-Feb-2011 00:00

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

Posted by Community Admin on 28-Feb-2011 00:00

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

This thread is closed