This post specifically discusses the authentication mechanisms forms and windows. By Default Silverlight Business Application allows the users to register and login with built in controls.This template also gives you navigation ability where you can easily add Silverlight pages for additional functionality. It also enables authentication, roles and profiles.1. Select the Silverlight project typeThen, click ok. Notice that the following structure will be created where silverlight pages can be found in Silverlight client project views folder2. Right click the Silverlight client project and select properties. Notice at the bottom of the project properties of the dialogue box RIA Services link exists between the client and server projects.3. Hit F5 and you’ll see the home page4. Click on the login link5. Click the registration link from above windows then you’ll see the following windowBy default Silverlight uses the Forms authentication. To use the windows authentication
Open the web.config file from Silverlight server project and change the authentication mode as shown below 1: <authentication mode="Windows"> 2: </authentication>Open the App.xaml.cs for the App.xaml file and change the code as shown in below 1: /// <summary> 2: /// Creates a new <see cref="App"/> instance. 3: /// </summary> 4: public App() 5: { 6: InitializeComponent(); 7: 8: // Create a WebContext and add it to the ApplicationLifetimeObjects collection. 9: // This will then be available as WebContext.Current. 10: WebContext webContext = new WebContext(); 11: //webContext.Authentication = new FormsAuthentication(); 12: webContext.Authentication = new WindowsAuthentication(); 13: this.ApplicationLifetimeObjects.Add(webContext); 14: }Build and run the application, now you will notice login details with windows authentication.
Related posts
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.
We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.
Sign in