web designer, release blocked files (IIS)

Stimulsoft Reports.WEB discussion
Post Reply
amir.heydari
Posts: 1
Joined: Sat Jun 20, 2015 11:41 am

web designer, release blocked files (IIS)

Post by amir.heydari »

Hi
I use web designer to edit a special report.
@Html.Stimulsoft().StiMvcMobileDesigner(
"MvcMobileDesigner1",
new StiMvcMobileDesignerOptions
{
ActionGetReportTemplate = "GetReportTemplate",
ActionGetReportSnapshot = "GetReportSnapshot",
ActionSaveReportTemplate = "SaveReportTemplate",
ActionDesignerEvent = "DesignerEvent",

ShowSaveDialog = false,
ShowDictionary = false,
ShowPropertiesGrid = false,
ShowInsertButton = false,
ShowPageButton = false,
ShowPreviewButton = false,
ServerCacheMode = StiDesignerCacheMode.Page,

ShowFileMenuOpen = false,
ShowFileMenuNew = false,
ShowFileMenuClose = false,
})

My reports have a image in background that I set path of this image manually.
public ActionResult GetReportTemplate()
{
StiReport report = new StiReport();
var reportFileName = Server.MapPath(…….…);

report.Load(reportFileName);
StiImage memberImg = report.GetComponents()["templateImage"] as StiImage;
memberImg.File = Server.MapPath(“image1.jpg”));

return StiMvcMobileDesigner.GetReportTemplateResult(HttpContext, report);
}
Designer works well and I can change the report and save it.
But after save and close report designer, I cannot delete or change “image1.jpg” because this file is blocked by IIS.

How can I release image file after saving reports?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: web designer, release blocked files (IIS)

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

StiImage memberImg = report.GetComponents()["templateImage"] as StiImage;
FileStream fs = new FileStream("Path to image", FileMode.Open, FileAccess.Read);
byte[] buf = new byte[fs.Length];
fs.Read(buf, 0, buf.Length);
fs.Close();
img.Image = StiImageHelper.GetImageFromObject(buf);
Thank you.
Post Reply