Page 1 of 1

web designer, release blocked files (IIS)

Posted: Sat Jun 20, 2015 11:44 am
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?

Re: web designer, release blocked files (IIS)

Posted: Mon Jun 22, 2015 12:04 pm
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.