इसके बाद से मैं इस कोड किया समय हो गया है बनी हुई है, लेकिन यह मदद मिल सकती है: आपका वेब परियोजना एक वेब साइट हो गया है, और "एएसपी.Net वेब एप्लिकेशन" प्रकार की प्रोजेक्ट नहीं है, या आप नीचे उल्लिखित संदर्भ जोड़ने में सक्षम नहीं होंगे। प्रोजेक्ट पर राइट क्लिक करें और एएसपी.Net फ़ोल्डर जोड़ें - App_WebReferences। आपको उस सर्वर को निर्दिष्ट करना होगा जहां आपका एसआरएस है; .asmx का चयन करें। एक बार यह जोड़ा जाने के बाद, उस स्तर के नीचे वाले फ़ोल्डर को आरएसएस सेवा कहा जाता है, और उसके तहत 2 चीजें हैं: reportservice.discomap & .wsdl। मेरी वीबी में, मैं आयात RSService और आयात System.Web.Services.Protocols करते हैं, तो ...
Dim MyRS As New ReportingService
रिपोर्टिंग सेवा वेब सर्वर अनुप्रयोग पर है तुलना में एक अलग सर्वर पर है, इसलिए मैं कर सकते हैं ' MyRS.Credentials = System.Net.CredentialCache.DefaultCredentials
बजाय: टी निम्न कार्य करें। MyRS.Credentials = New System.Net.NetworkCredential(rs1, rs2, rs3)
, जहां RS1/2/3 एसआरएस बॉक्स, एसआरएस बॉक्स करने के लिए पासवर्ड, & डोमेन नाम "करने के लिए प्रवेश कर रहे हैं (। ये मेरी web.config में एन्क्रिप्ट किए गए हैं)
फिर, एक द्रव्यमान पेस्ट:
MyRS.Credentials = New System.Net.NetworkCredential(rs1, rs2, rs3)
Dim ReportByteArray As Byte() = Nothing
Dim ReportPath As String = "/SRSSiteSubFolder/ReportNameWithoutRDLExtension"
Dim ReportFormat As String = "PDF"
Dim HistoryID As String = Nothing
Dim DevInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"
'Dim x As ReportParameter - not necessary
Dim ReportParams(0) As ParameterValue
ReportParams(0) = New ParameterValue()
ReportParams(0).Name = "TheParamName"
ReportParams(0).Value = WhateverValue
Dim Credentials As DataSourceCredentials() = Nothing
Dim ShowHideToggle As String = Nothing
Dim Encoding As String
Dim MimeType As String
Dim ReportHistoryParameters As ParameterValue() = Nothing
Dim Warnings As Warning() = Nothing
Dim StreamIDs As String() = Nothing
'Dim sh As New SessionHeader() - not necessary
''MyRS.SessionHeaderValue = sh - not necessary
ReportByteArray = MyRS.Render(ReportPath, ReportFormat, HistoryID, DevInfo, ReportParams, Credentials, _
ShowHideToggle, Encoding, MimeType, ReportHistoryParameters, Warnings, StreamIDs)
'(Yay! That line was giving "HTTP error 401 - Unauthorized", until I set the credentials
' as above, as explained by http://www.odetocode.com/Articles/216.aspx.)
'Write the contents of the report to a PDF file:
Dim fs As FileStream = File.Create(FullReportPath, ReportByteArray.Length)
fs.Write(ReportByteArray, 0, ReportByteArray.Length)
fs.Close()
Call EmailTheReport(FullReportPath)
If IO.File.Exists(FullReportPath) Then
IO.File.Delete(FullReportPath)
End If
क्या होगा अगर मैं स्थानीय रिपोर्ट का उपयोग नहीं कर रहा हूं लेकिन यूआरएल पर स्पष्ट मूल्य नहीं छोड़ना चाहता हूं? – Leonardo