Problem connecting to report

Discussion in 'General troubleshooting' started by prairieflow, Dec 19, 2010.

  1. I am getting the message "The Request failed with HTTP status 401:Unauthorized".

    I have created a report using Report Builder 2 which I have uploaded to the server. I am using Report Viewer imbedded in my application to access the report.

    I am a real beginner with Report Services. When I was working only with aspx pages that displayed gridviews connected to my data base I was using "Windows" authorization which did not require any special security code. However, now that I am trying to create reports I understand that the report server does not support "Windows" authorization so I must add additional securities code which is something that is new for me. What I would like to be able to do is to make accessing these reports as easy as possible for my users - any user that has access to the aspx form that contains the Report View should be able to view the report.

    I am assuming that there is something missing from either the code contained in the report file or the code contained in the Report Viewer and/or possibly something is missing from my config.web file.

    The code at the beginning of the report file (FPPCScheduleENewX.rdl) which includes 'DataSource' information is as follows:

    <?xml version="1.0" encoding="utf-8" ?>
    - <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
    - <DataSources>
    - <DataSource Name="DataSource1">
    - <ConnectionProperties>
    <DataProvider>SQL</DataProvider>
    <ConnectString>Data Source=MICHELE-PC;Initial Catalog=ElectionMasterDatabase</ConnectString>
    <IntegratedSecurity>false</IntegratedSecurity>
    </ConnectionProperties>
    <rd:DataSourceID>477f9525-a2ae-4b00-8aa0-8d0e92b84001</rd:DataSourceID>
    <rd:SecurityType>Forms</rd:SecurityType>
    </DataSource>
    </DataSources>

    The code for the Report Viewer contains the following:

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
    Font-Size="8pt" Height="400px" ProcessingMode="Remote" Width="400px">
    <ServerReport ReportPath="/prairieflow/reports/FPPCScheduleENewX"
    ReportServerUrl="https://rs2k801.discountasp.net/ReportServer" />
    </rsweb:ReportViewer>


    Some of the code included in the web.config file is as follows:

    <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    </sectionGroup>
    </sectionGroup>
    </sectionGroup>
    </configSections>

    <connectionStrings>
    <add name="NewElectionMasterDatabaseConnectionString" connectionString="Data Source=tcp:sql2k804.discountasp.net;Initial Catalog=SQL2008R2_784070_electiondev;User ID=SQL2008R2_784070_electiondev_user;Password=superfly;"
    providerName="System.Data.SqlClient" />

    <add name="VoterDatabaseConnectionString" connectionString="Data Source=tcp:sql2k804.discountasp.net;Initial Catalog=SQL2008R2_784070_electiondev;User ID=SQL2008R2_784070_electiondev_user;Password=******;"
    providerName="System.Data.SqlClient" />
    </connectionStrings>

    <authentication mode="Forms" />

    <httpHandlers>
    <remove verb="*" path="*.asmx"/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </httpHandlers>

    Any help would be appreciated.

    Bette
     
  2. dmitri

    dmitri DiscountASP.NET Staff

    I replaced the password with ****** in your connection string to prevent public access to your database. Please see this community post that shows how to supply credentials to the reporting servers from your ASP.NET code.
     
  3. still getting 401: unauthorized message

    I read the recommended article and I have entered the suggested code into the aspx.vb file that is referenced from my aspx form that contains the Report Viewer. I have attached a copies of both of these forms. I converted the files to 'text so that I could attach them.

    I added the appSettings for MyReportViewerUser, MyReportViewerPassword, and MyReportViewerDomain to my web.config file. These are the same user and password that I enter when accessing the report server from my discount asp.net account so they should be correct.

    I am thinking that maybe there is some other entry in my web.config file that is either missing or contains incorrect information. I converted the file to text and have also attached that file. Note: I replaced the name, password, and domain name with "xxxxxxxx".

    I am really at wits end as to what I need to do.
     

    Attached Files:

  4. mjp

    mjp

    the line above suggests that you are trying to access the Reporting Service from outside our network. Is that the case? If so, that is not allowed for security purposes.
     
  5. I am not trying to access anything from outside of your network. I am trying to access a report that has been uploaded to your report server from a form containing a Report Viewer that is part of my web site which is running on your network. Other than the problem of accessing reports, everything else on the website is working just fine - the forms that display data in gridviews works fine - the only problem I have is with trying to access a report on the report server.

    I am sorry to be such a bother but I just do not understand what I am doing wrong. I keep thinking that it must be some small piece of code that is either in my web.config file or the Report Viewer or the report that is causing my problem.

    I really appreciate your help.

    Bette
     
  6. I think that I may have it working. As soon as I know for sure I will get back to you.

    Bette
     
  7. problem defining connection in Report Builder

    I am attempting to create a report using Report Builder. I am working from my local computer but I want to enter the connection properties to attach my database that is on located on the discountasp.net server.

    When I enter the values into the Connection Properties and then click on the 'test connection' button, I get the message "login failed for user xxxxx" (I have substibuted x's for my user name).

    The reason that I am trying to do this is that when I create the report using the database on my local computer and then upload the report file to the report server the connection string for the report still is for the local database and I do not know how to edit the report file so that the connection string is for the server.

    The values that I have entered into the Connection Properties form are as follows:

    Data source: Microsoft SQL Server (SqlClient)
    Servername: sql2k804.discountasp.net
    Use: SQL Server Authentication
    username: xxxxxx
    password: xxxxxx
    database name: SQL2008R2_784070_electiondev

    Bette
     
  8. The error should just mean you're using incorrect credentials. Are you able to log into the database using MyLittleAdmin ? Just to make sure you're able to connect to the database and you have the correct user/pass.
     
  9. I now have it working.

    Thanks,

    Bette
     
  10. mjp

    mjp

    How did you get it to work?
     

Share This Page