http 401 access denied RRS feed

  • Question

  • User106761762 posted

    hello, I just created two project, the first one is a web app project and the second is a web site project, both wit the same call to a sql server 205 reporting service in a server. When I test the first one the report runs ok, but with the web site project i recieve the http 401 error. This is my code, is the same in both project, plese help me.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Página sin título</title>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td>
                <asp:Panel ID="Panel1" runat="server" Visible="false" >
                 <rsweb:ReportViewer ID="ReportViewer1" runat="server">

    And this is my vb code:
    Imports Microsoft.Reporting.WebForms
    Partial Class _Default
        Inherits System.Web.UI.Page
        Protected sargumento() As String
        Protected svalor() As String

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim litotalarg, liindice As Integer
            Dim lsProvincia As String = "8"
            Dim lsFecIni As String = "20110401"
            Dim lsFecFin As String = "20111001"
            Dim ls_nrepo As String = "LatasPorDevolver"
            Dim lsArgumentosFinal As String = "&provincia=" + lsProvincia + "&pFecini=" + lsFecIni.ToString + "&pFecfin=" + lsFecFin.ToString
            Dim urlReportes As String = ConfigurationManager.AppSettings.Get("UrlReportes")
            Dim lsReporte As String = urlReportes + "/" + ls_nrepo
            If lsArgumentosFinal <> "" Then
                lsArgumentosFinal = Mid(lsArgumentosFinal, 2, lsArgumentosFinal.Length - 1)
            End If

            ReportViewer1.ProcessingMode = ProcessingMode.Remote

            ReportViewer1.ServerReport.ReportServerUrl = New Uri(ConfigurationManager.AppSettings.Get("ServerUrl"))
            ReportViewer1.ServerReport.ReportPath = lsReporte

            litotalarg = Me.sargumento.Length - 1
            Dim parameters(litotalarg) As ReportParameter
            For liindice = 0 To litotalarg
                parameters(liindice) = New ReportParameter(svalor(0), svalor(1))


            'Se habilita la entrada de parametros
            With ReportViewer1
                .ShowBackButton = True
                .PromptAreaCollapsed = True
                .ShowDocumentMapButton = True
                .ShowExportControls = True
                .ShowFindControls = True
                .ShowPageNavigationControls = True
                .ShowParameterPrompts = True
                .ShowPrintButton = True
                .ShowPromptAreaButton = True
                .ShowRefreshButton = True
                .ShowReportBody = True
                .ShowToolBar = True
                .ShowZoomControl = True
            End With
            Me.Panel1.Visible = True
        End Sub
        Protected Sub SepararArgumentos(ByVal vsargumentos As String)
            sargumento = Split(vsargumentos, "&", -1, 1)
        End Sub
        Protected Sub SepararValores(ByVal vsargumentos As String)
            svalor = Split(vsargumentos, "=", -1, 1)
        End Sub
    End Class


    Monday, April 11, 2011 12:27 PM


  • User-305876627 posted

    if the website/ application is deployed and running on Windows authentication:

    go to IIS Manager --> on left select the web app --> find Authentication (under Features View in IIS 7) -->  double click Authentication --> Disable ASP.Net Impersonation / Forms Authentication / Anonymous Authentication

    Run the project

    alternatively you can do the same in web.config file.

    hope this help


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 12, 2011 1:05 PM