Showing posts with label authentication.. Show all posts
Showing posts with label authentication.. Show all posts

Report viewer control authentication – Part1 – Windows Authentication

Report viewer control, I think everyone knows what it is and how to use it. Today, I want to tell you how to authenticate the report viewer control in ASP.NET web application or windows application.

The report viewer control passing the credentials is same in both windows and web applications. How to pass windows credentials to the report viewer control?

  • Either you can set the <identity impersonation="true" /> or
  • You can directly pass the credentials object to the report viewer control as shown below. If default credentials then
    System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;ReportServerCredentials rsCredentials = serverReport.ReportServerCredentials; rsCredentials.NetworkCredentials = credentials;

    But, in some scenarios, you may need to pass the windows credentials dynamically instead of the logged in user credentials. Then it's the time to use NetworkCredentials object. Check below.

    ICredentials credentials = new NetworkCredential("User name", "Password", "Domain");

    Now, assign this credentials object to the report viewer credentials. So, I prefer to not directly give the credentials directly in the code. Instead add them in the web.config and access them in the code.

    I think, you understood it well. Love to hear comments.

Read More...

How to enable Sql Server Authentication in Sql server.

Usually, while installing the sql server, we select the option to use the Windows authentication mode to connect to sql server. But for some scenarios we need Sql server authentication mode to access the database. How to changes? Below are the steps to follow to enable sql server authentication for sql server.
  1. Login to sql server with windows authentication.
  2. Right click on the server (your sql server name), select properties.
  3. In the section, select a page, select security and in the server authentication section select the radio button SqlServer and windows Authentication mode, then click ok.
  4. After your changes saved, then go to Security -- users -- add a user for sql authentication.
  5. Needs restart for the server to reflect the changes.
Read More...
Related Posts with Thumbnails
GiF Pictures, Images and Photos