ASP.NET can not call outlook function to create .msg file - asp.net

I need create a outlook .msg file by IIS, it is ok when I run it in "IIS Express", but can not run in IIS even set applicationpool to LocalSystem.
Error message:Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) at Microsoft.Office.Interop.Outlook.Attachments.Add(Object Source, Object Type, Object Position, Object DisplayName)
Environment: Win7 32bit, Office 2010, Vistual Studio Pro 2013
Source code as following:
Try
Dim oApp As Interop.Outlook._Application
Dim oMsg As Interop.Outlook._MailItem
oApp = New Interop.Outlook.Application
oMsg = oApp.CreateItem(Interop.Outlook.OlItemType.olMailItem)
oMsg.Subject = "Test Subject"
oMsg.Body = "Test Body"
oMsg.To = ""
Dim attachedFilePath As String = "C:\\temp\\A1234563A.zip"
If String.IsNullOrEmpty(attachedFilePath) = False Then
Dim sBodyLen As Integer = Int(oMsg.Body)
Dim oAttachs As Interop.Outlook.Attachments = oMsg.Attachments
Dim oAttach As Interop.Outlook.Attachment
oAttach = oAttachs.Add(attachedFilePath, , sBodyLen, "A1234563A.zip")
End If
oMsg.SaveAs("c:\\temp\\abcd.msg", Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
Catch ex As System.Exception
'xxxxx
Finally
GC.Collect()
GC.WaitForPendingFinalizers()
End Try

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
Read more about that in the Considerations for server-side Automation of Office article.

Thanks All, At last I do it as following:
1. Create a template .msg file by outlook manually.
2. Open it and copy to a new stream. Many code for this from intenet.
3. Update my information to this stream, and save as a new .msg file. (Following is source when I update attachment file in .msg file, and you should get other source from OutlookStorage.cs).
//create a ILockBytes (unmanaged byte array) and then create a IStorage using the byte array as a backing store
NativeMethods.CreateILockBytesOnHGlobal(IntPtr.Zero, true, out memoryStorageBytes);
NativeMethods.StgCreateDocfileOnILockBytes(memoryStorageBytes, NativeMethods.STGM.CREATE | NativeMethods.STGM.READWRITE | NativeMethods.STGM.SHARE_EXCLUSIVE, 0, out memoryStorage);
//copy the save storage into the new storage
saveMsg.storage.CopyTo(0, null, IntPtr.Zero, memoryStorage);
//Attachments (37xx):
//0x3701: Attachment data <- This is the binary attachment
//0x3703: Attach extension
//0x3704: Attach filename
//0x3707: Attach long filenm
//0x370E: Attach mime tag
//0x3712: Attach ID (?)
// replace attachment with myself file
var myNameIdSourceStorage = memoryStorage.OpenStorage(OutlookStorage.ATTACH_STORAGE_PREFIX + "00000000", IntPtr.Zero, NativeMethods.STGM.READWRITE | NativeMethods.STGM.SHARE_EXCLUSIVE,IntPtr.Zero, 0);
myNameIdSourceStorage.DestroyElement("__substg1.0_37010102");
// Create the property stream again and write in the padded version
var pStream = myNameIdSourceStorage.CreateStream("__substg1.0_37010102",
NativeMethods.STGM.READWRITE | NativeMethods.STGM.SHARE_EXCLUSIVE, 0, 0);
pStream.Write(newFileByte, newFileByte.Length, IntPtr.Zero);
// Open stream from the storage
var mystream = myNameIdSourceStorage.OpenStream("__properties_version1.0", IntPtr.Zero,
NativeMethods.STGM.READWRITE | NativeMethods.STGM.SHARE_EXCLUSIVE, 0);
System.Runtime.InteropServices.ComTypes.STATSTG elementStats;
mystream.Stat(out elementStats, 0);
// Read the stream into a managed byte array
var iStreamContent = new byte[elementStats.cbSize];
mystream.Read(iStreamContent, iStreamContent.Length, IntPtr.Zero);
iStreamContent[0xc0] = (byte)(newFileByte.Length & 0xFF);
iStreamContent[0xc1] = (byte)(newFileByte.Length >> 8);
iStreamContent[0xc2] = (byte)(newFileByte.Length >> 16);
iStreamContent[0xc3] = (byte)(newFileByte.Length >> 24);
mystream.Write(iStreamContent, 0, IntPtr.Zero);
//0x3704: Attach filename
myNameIdSourceStorage.DestroyElement("__substg1.0_3704001F");
pStream = myNameIdSourceStorage.CreateStream("__substg1.0_3704001F",
NativeMethods.STGM.READWRITE | NativeMethods.STGM.SHARE_EXCLUSIVE, 0, 0);
pStream.Write(newProps, 8, IntPtr.Zero);

Your options are
Extended MAPI (OpenImsgOnIStg etc.) to create an MSG file and set all the relevant MAPI properties, but it is only accessible from the C++ or Delphi
Use Windows API to build the file explicitly in your code (its format is documented) - https://msdn.microsoft.com/en-us/library/cc463912(v=exchg.80).aspx
Use Redemption (I am its author) - it is an Extended MAPI wrapper that can be used from a service in any language including C#, VB.Net or VB script:
set Session = CreateObject("Redemption.RDOSession")
set Msg = Session.CreateMessageFromMsgFile("C:\Temp\test.msg")
Msg.Sent = true
set recip = Msg.Recipients.AddEx("This user", "this.user#domain.demo", "SMTP", olTo)
Msg.Subject = "fake received message"
Msg.Body = "just a test"
Msg.SentOn = Now
Msg.ReceivedTime = Now
'set the sender related properties
vSenderEntryId = Session.CreateOneOffEntryID("Joe The Sender", "SMTP", "joe#domain.demo", false, true)
'PR_SENDER_xyz
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1E001F") = "SMTP"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1F001F") = "joe#domain.demo"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C190102") = vSenderEntryId
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1A001F") = "Joe The Sender"
'PR_SENT_REPRESENTING_xyz
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0064001F") = "SMTP"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0065001F") = "joe#domain.demo"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x00410102") = vSenderEntryId
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0042001F") = "Joe The Sender"
'all done
Msg.Save

I use System.Net.Mail instead - https://msdn.microsoft.com/en-us/library/system.net.mail(v=vs.110).aspx
You set up a MailMessage, you can add attachments and set importance, and do everything you're doing above.
This works very well for me, and you don't need to install anything on the server.
EDIT
Here's some sample code for you - import the System.Net.Mail and System.Configuration namespaces. In this example, I'm sending a log, so I get the to addresses and SMTP relay from App.Config. You can change these for what you need.
This also attaches a file from a location also specified in App.Config.
string[] recipients = ConfigurationManager.AppSettings["recipients"].ToString().Split(',');
MailMessage msg = new MailMessage();
msg.From = new MailAddress("noreply#somewhere.com");
msg.Subject = "Log Error Report";
foreach (string addr in recipients)
{
msg.To.Add(new MailAddress(addr));
}
string body = System.Environment.NewLine + "Please check these logs for errors.";
body += System.Environment.NewLine + "Message line 2";
msg.Body = body;
msg.Priority = MailPriority.High;
String attchMnts = ConfigurationManager.AppSettings["logfile"].ToString();
String[] attchPaths = attchMnts.Split(',');
foreach (string path in attchPaths)
{
Attachment atch = new Attachment(path);
msg.Attachments.Add(atch);
}
SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["smtpRelay"].ToString());
client.Send(msg);

Outlook Object Model cannot be used from a service (including IIS). Your options are:
Use Extended MAPI (OpenIMsgOnIStg etc.) to create an MSG file and set all the relevant MAPI properties, but it is only accessible from the C++ or Delphi. Note the Outlook must be installed for the Extended MAPI system to be present. Since MAPI system is loaded in-proc, the bitnes of your code must match that of Outlook/MAPI.
Use Windows API to build the file explicitly in your code (it's format is documented) - https://msdn.microsoft.com/en-us/library/cc463912(v=exchg.80).aspx
Use Redemption (I am its author) - it is an Extended MAPI wrapper that can be used from a service in any language including C#, VB.Net or VB script:
set Session = CreateObject("Redemption.RDOSession")
set Msg = Session.CreateMessageFromMsgFile("C:\Temp\test.msg")
Msg.Sent = true
set recip = Msg.Recipients.AddEx("This user", "this.user#domain.demo", "SMTP", olTo)
Msg.Subject = "fake received message"
Msg.Body = "just a test"
Msg.SentOn = Now
Msg.ReceivedTime = Now
'set the sender related properties
vSenderEntryId = Session.CreateOneOffEntryID("Joe The Sender", "SMTP", "joe#domain.demo", false, true)
'PR_SENDER_xyz
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1E001F") = "SMTP"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1F001F") = "joe#domain.demo"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C190102") = vSenderEntryId
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0C1A001F") = "Joe The Sender"
'PR_SENT_REPRESENTING_xyz
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0064001F") = "SMTP"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0065001F") = "joe#domain.demo"
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x00410102") = vSenderEntryId
Msg.Fields("http://schemas.microsoft.com/mapi/proptag/0x0042001F") = "Joe The Sender"
'all done
Msg.Save

Related

How to show a pdf file in a web page present on secured web hosting

I am trying to show a pdf file in aspx page using FTP but always error 'File Not Found'
Here is my code..
Dim localFile As String = Server.MapPath("~/Test.pdf")
Dim URI As String = "ftp://mysitename/%2f/httpdocs/Folder1/Folder2/Folder3/image123.pdf"
Dim ftp As System.Net.FtpWebRequest = CType(FtpWebRequest.Create(URI), FtpWebRequest)
ftp.Credentials = New NetworkCredential("username", "password")
ftp.KeepAlive = False
ftp.UseBinary = True
ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
Using response As System.Net.FtpWebResponse = CType(ftp.GetResponse, System.Net.FtpWebResponse)
Using responseStream As IO.Stream = response.GetResponseStream
Using fs As New IO.FileStream(localFile, IO.FileMode.Create)
Dim buffer(2047) As Byte
Dim read As Integer = 0
Do
read = responseStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, read)
Loop Until read = 0
responseStream.Close()
fs.Flush()
fs.Close()
End Using
responseStream.Close()
End Using
response.Close()
End Using
Response.Redirect("~/Test.pdf")
This code runs perfectly from VS2012 because the Test.pdf file is created where the .sln file resides. But when uploaded in web hosting it shows the error that :
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
I also tried..
Dim localFile As String = HttpContext.Current.Server.MapPath("~/Test.pdf")
Dim localfile As String = HostingEnvironment.MapPath("~/Test.pdf")
But all in vein..
Please help. Thanks..

How to execute an SSRS .rss script file in IIS/ASP.NET

I need to execute a .rss SSRS script file within an ASP.NET application running in IIS 7.x. How can I do that?
Do I have to configure the IIS AppPool that is running my web application to have elevated privileges such that I can start up the rs.exe console application passing the .rss script to it the way I would otherwise execute an .rss script file outside of IIS?
Or is there another way? Does Visual Studio/.NET provide any mechanism for bootstrapping an .rss script file without needing the rs.exe console application? Is my only option to make the rs.exe console application available to my web application running in IIS?
So, I figured it out. If you're wondering how to create a History Snapshot of a report on your SSRS Reports Server using the ReportServices2010 proxy, here's one example and one way you can accomplish it (many thanks to kyzen for sharing his insight in directing me to the SOAP API):
Dim basicHttpBinding As New BasicHttpBinding()
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm
basicHttpBinding.SendTimeout = New TimeSpan(0, 10, 0)
Dim endPoint As New EndpointAddress("http://server/reportserver/ReportService2010.asmx")
Dim instance As New ReportingService2010SoapClient(basicHttpBinding, endPoint)
Dim itemPath As String = "/Path/to/report"
Dim warnings() As Warning
Dim historyId As String = Nothing
Dim values As ParameterValue() = Nothing
Dim credentials As DataSourceCredentials() = Nothing
Dim t As New TrustedUserHeader()
instance.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation
instance.ClientCredentials.Windows.ClientCredential = New Net.NetworkCredential("userid", "password", "domain")
instance.Open()
oServerInfoHeader = instance.CreateItemHistorySnapshot(t, itemPath, historyId, warnings)
and in C#:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm
basicHttpBinding.SendTimeout = New TimeSpan(0, 10, 0)
EndpointAddress endPoint = new EndpointAddress("http://server/reportserver/ReportService2010.asmx");
ReportingService2010SoapClient instance = new ReportingService2010SoapClient(basicHttpBinding, endPoint);
string itemPath = "/Path/to/report"
Warning warnings[];
string historyId;
ParameterValue values[];
DataSourceCredentials credentials[];
TrustedUserHeader t = new TrustedUserHeader();
instance.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
instance.ClientCredentials.Windows.ClientCredential = New Net.NetworkCredential("userid", "password", "domain");
instance.Open();
oServerInfoHeader = instance.CreateItemHistorySnapshot(t, itemPath, historyId, warnings);

how to call page which creates pdf

I have a page called OrderExport.aspx which creates a pdf file in a folder on the server.
In my page OrderSend.aspx I have a function which sends an e-mail with the pdf file attached, like this:
Dim atc As Net.Mail.Attachment = New Attachment(stm, fileNameOrder)
mail.Attachments.Add(atc)
How can I call OrderExport.aspx from this function before sending the e-mail without showing it for the user?
I need to make sure that the pdf file exists when sending the e-mail.
You probably want to create a class rather than an aspx page to handle the PDF creation. One way to do this is to use the PDFSharp library which can handle creating the PDF document and then saving it to a stream which can be attach to an email message. You could also save the stream to a file on the server at the same time.
' Create a new PDF document
Dim document As PdfDocument = New PdfDocument
document.Info.Title = "TITLE"
Dim securitySettings As Security.PdfSecuritySettings = document.SecuritySettings
' Restrict some rights.
securitySettings.PermitAccessibilityExtractContent = False
securitySettings.PermitAnnotations = False
securitySettings.PermitAssembleDocument = False
securitySettings.PermitExtractContent = False
securitySettings.PermitFullQualityPrint = True
securitySettings.PermitModifyDocument = False
securitySettings.PermitPrint = True
' Create an empty page
Dim page As PdfPage = document.AddPage
' Get an XGraphics object for drawing
Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
Dim img As XImage = XImage.FromGdiPlusImage(imgPermit)
gfx.DrawImage(img, 20, 20)
Dim stream As New MemoryStream()
document.Save(stream, False)
Dim xStream As System.IO.Stream = stream
SendEmail(sEmail, xStream)
in your mail message it would be constructed similar to this
Dim xStream As New Attachment(pdf, "FILE" + Date.Now.ToString("MM.dd.yyyy") + ".pdf")
mm.Attachments.Add(xStream)
You need to separate the GUI from the actual logic.
You presumably have code in OrderExport.aspx that creates the PDF and saves it to disk. You should put that code into a separate class, so that you can call it from OrderExport.aspx, and from the page with the "Send e-mail" button. Similarly, extract the code for sending the email from OrderSend.aspx and call it from there, and from the "Send e-mail" button.
Separation of Concerns is the best solution, but if you need a quick solution -not a good one- make the class and the function public and call it like any other class

Crystal Report print functionlity doesn't work after deployment?

I'm using crystal reports to build reports, everything is ok while development.
But after deployment of website, print functionality doesn't work.
I use _rptDocument.PrintToPrinter(1, false, 0, 0); to print report.
I've tried two methods to deploy website
Normal Publish option.
Web Deployment Project.
But I got the same output, print functionality doesn't work.
Also, I tried to set default printer, this also doesn't work.
Any ideas?
Printing on a web server isn`t a good idea. What should happen? A user prints on your servers printer? Use CR to create PDFs. Stream them to your clients. They can use their local printers.
try this :- Create PDF and open Browser Tab ...enter code here
string fname = "Report" + ".pdf";`enter code here`
//Create instance for crystal report Export option class
ExportOptions exprtopt = default(ExportOptions);
//create instance for destination option - This one is used to set path of your pdf file save
DiskFileDestinationOptions destiopt = new DiskFileDestinationOptions();
//Bind data in the crystal report first before export cystal report to PDF
ReportDocument RptDoc = new ReportDocument();
//Map your crystal report path
// RD.Load(Server.MapPath("~/CrystalReport2.rpt"));
//Set your crystal report datasource as dt
//Get path and assign into destination DiskFileName
destiopt.DiskFileName = Server.MapPath(fname);
exprtopt = RD.ExportOptions;
exprtopt.ExportDestinationType = ExportDestinationType.DiskFile;
//use PortableDocFormat for PDF data
exprtopt.ExportFormatType = ExportFormatType.PortableDocFormat;
exprtopt.DestinationOptions = destiopt;
//finally export your report document
RD.Export();
//To open your PDF after save it from crystal report
string Path = Server.MapPath(fname);
//create instance to client to open your pdf
WebClient client = new WebClient();
//Assign path to download pdf
Byte[] buffer = client.DownloadData(Path);
//metion content type as PDF and write
// Response.ContentType = "application/pdf";
//Response.AddHeader("content-length", buffer.Length.ToString());
//Response.BinaryWrite(buffer);
//======================================
Response.Write("<script>");
Response.Write("window.open('" + fname + "', '_newtab');");
Response.Write("</script>");
//===================================
IMTIYAZ

How to pass parameters to SSRS report programmatically

I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this.
Does anyone have any suggestions on where to go to get help with this, or perhaps even some sample code?
Thanks.
You can do the following,: (it works both on local reports as in Full Blown SSRS reports. but in full mode, use the appropriate class, the parameter part remains the same)
LocalReport myReport = new LocalReport();
myReport.ReportPath = Server.MapPath("~/Path/To/Report.rdlc");
ReportParameter myParam = new ReportParameter("ParamName", "ParamValue");
myReport.SetParameters(new ReportParameter[] { myParam });
// more code here to render report
If the Report server is directly accessible, you can pass parameters in the Querystring if you are accessing the repoort with a URL:
http://MyServer/ReportServer/?MyReport&rs:Command=Render&Param1=54321&Param2=product
You can add output formatting by adding the following on the end of the URL:
&rs:Format=Excel
or
&rs:Format=PDF
It's been a while since I did this code, but it may help:
Your web project has to be a Web Site, and not a project of type "ASP.Net Web Application", or you won't be able to add the reference mentioned below.
Right click on the project and add an ASP.Net folder - App_WebReferences. You'll have to specify the server where your SRS is; choose the .asmx.
Once it's added, the folder under that level is called RSService, and under that are 2 things: reportservice.discomap & .wsdl.
In my VB, I do Imports RSService and Imports System.Web.Services.Protocols, then...
Dim MyRS As New ReportingService
The reporting service is on a different server than the webserver the app is on, so I can't do the following: MyRS.Credentials = System.Net.CredentialCache.DefaultCredentials
Instead: MyRS.Credentials = New System.Net.NetworkCredential(rs1, rs2, rs3),
where the rs1/2/3 are the login to SRS box, password to SRS box, & domain name". (These are encrypted in my web.config.)
Then, a mass-paste:
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
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.Reset();
Label1.Visible = false;
ReportViewer1.Visible = true;
DataSet dataSet = new DataSet();
dataSet = new ClassBLL().Load_Report_Detail(TextBox1.Text,
ddlType.SelectedValue, levelcode, fields);
ReportDataSource datasource = new ReportDataSource("DataSet_StoreprocedureName",
dataSet.Tables[0]);
if (dataSet.Tables[0].Rows.Count == 0)
{
ReportViewer1.Visible = false;
}
ReportViewer1.LocalReport.ReportPath = Server.MapPath("") + #"\Report.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
string fields="name,girish,Z0117";
string[] filedName = fields.Split(',');
ReportParameter[] param = new ReportParameter[2];
//for (int i = 0; i < filedName.Length; i++)
//{
param[0] = new ReportParameter(filedName[0], filedName[0], true);
param[1] = new ReportParameter(filedName[3], filedName[3], true);
// }
ReportViewer1.LocalReport.SetParameters(param);
ReportViewer1.ServerReport.Refresh();

Resources