Public Shared Function GetPageBackgroundImage(managedByPartnerId As Integer) If managedByPartnerId = 1 Then Return Bitmap.FromFile("P:\Billing Systems\BESTPASS AM\Invoice Templates\Current\DW Page Invoice.png") Else Return Bitmap.FromFile("P:\Billing Systems\BESTPASS AM\Invoice Templates\Current\Page Invoice.png") End If End FunctionI have a picture box in my report. The images are dynamically generated based on the content of a query string. The problem I have is that I receive an access denied error message whenever I use a relative URL path (ie "~/test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular").
When I use an absolute path (ie "http://localhost:53657/test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular") it works with no problem.
(this works)
pictDocType.Value = "http://localhost:53657/test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular"
(this does not work)
pictDocType.Value = "~/test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular"
pictDocType.Value = "/test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular"
pictDocType.Value = "../test/generateimage.aspx?font=2&text=ouncil Agenda&size=58&style=regular"
I want to be able to use relative paths when calling the images. Any help would be appreciated.
My report .aspx:CPR_Reports.SalesActivityReport report1 = new CPR_Reports.SalesActivityReport(myConnectionstring, Convert.ToInt32(Session["pk"].ToString()), Convert.ToInt32(Session["cpruser_no"].ToString()), fromdate, todate);InstanceReportSource instanceReportSource = new InstanceReportSource();instanceReportSource.ReportDocument = report1;this.ReportViewer1.ReportSource = instanceReportSource;My report class:public partial class SalesActivityReport : Telerik.Reporting.Report{ public SalesActivityReport(string myConnectionstring, int cfkwebuser, int cfkpnnames, string fromdate, string todate) { localConnectionstring = myConnectionstring; localCfkWebUser = cfkwebuser; localCfkPnnames = cfkpnnames; localFromDate = fromdate; localToDate = todate; InitializeComponent(reportHeaderBgColor, reportHeaderTextColor); SalesActivitySub1 salesActivitySub1 = new SalesActivitySub1(); SubReport subReport1 = new Telerik.Reporting.SubReport(); Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = salesActivitySub1; subReport1.ReportSource = instanceReportSource; subReport1.NeedDataSource += new EventHandler(subReport1_NeedDataSource); private void subReport1_NeedDataSource(object sender, EventArgs e) { EventLogger log1 = new EventLogger(); string commandText = @"exec wa_SalesActivityCallsLogged2 " + localCfkPnnames + ",'" + localFromDate + "','" + localToDate + " 23:59:59'"; try { SqlConnection sqlConnection1 = new SqlConnection(); SqlCommand sqlSelectCommand1 = new SqlCommand(); SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter(); sqlConnection1.ConnectionString = localConnectionstring; sqlSelectCommand1.CommandText = commandText; sqlSelectCommand1.Connection = sqlConnection1; sqlDataAdapter1.SelectCommand = sqlSelectCommand1; this.DataSource = sqlDataAdapter1; } catch (Exception ex) { log1.WriteError(ex); } finally { log1.Dispose(); } }}