UnauthorizedAccessException during report compilation
UnauthorizedAccessException during report compilation
We are deploying our MVC application on host.
All of our templates (.mrt) are deployed in a Templates folder and we are loading them from a Server.MapPath("~/...")
I found a similar question http://forum.stimulsoft.com/viewtopic.p ... ied#p19884 your solution was to give access to the folder which I did.
In order to make the application work, I had to give the EVERYONE user Execute access at Server.MapPath("~"). It's like the stimulsoft class wasn't running inside of the security context of the application pool (ASP.Net user)
Can you explain me why and can it be modified to make the application work under ASP.Net credentials (Application pool).
All of our templates (.mrt) are deployed in a Templates folder and we are loading them from a Server.MapPath("~/...")
I found a similar question http://forum.stimulsoft.com/viewtopic.p ... ied#p19884 your solution was to give access to the folder which I did.
In order to make the application work, I had to give the EVERYONE user Execute access at Server.MapPath("~"). It's like the stimulsoft class wasn't running inside of the security context of the application pool (ASP.Net user)
Can you explain me why and can it be modified to make the application work under ASP.Net credentials (Application pool).
Last edited by allo_man on Tue May 07, 2013 5:39 pm, edited 1 time in total.
Re: UnauthorizedAccessException during report compilation
Hello,
Unfortunately, it is difficult to say something on this issue. Possibly you need to make some settings on the server associated with the security settings.
Thank you.
Unfortunately, it is difficult to say something on this issue. Possibly you need to make some settings on the server associated with the security settings.
Thank you.
Re: UnauthorizedAccessException during report compilation
Thanks, I'll contact my hosting service to learn more about their configuration.
Regards,
Alex
Regards,
Alex
Re: UnauthorizedAccessException during report compilation
Hello,
Ok.
Let us know if you need any additional help.
Thank you.
Ok.
Let us know if you need any additional help.
Thank you.
Re: UnauthorizedAccessException during report compilation
I pinned pointed the error.
After compiling the report, the assembly is removed from the AppDomain and it loaded with no rights. I found two solutions to that problem:
1) Changing the StiConfig.ApplicationDirectory to a temp folder and setting the everyone right on that folder. That is a workaround but still I don't like opening security like that
2) Compiling my report to a dll and adding that dll in reference to my MVC application.
The 2nd option is the best solution for me plus it speed's up the report generation by 3/4 of a second, not negligable for a web application. The only issue I'm getting with that (because it just couldn't work on the first shot) it globalization.
my globalisation code looks like this:
var stiReport = new global::Reports.Certificat_De_Mise_En_Réserve();
stiReport.GlobalizationManager = new GlobalizationManager(reportModel.ResourceType, culture);
stiReport.Render(false);
stiReport.ExportDocument(StiExportFormat.Pdf, filepath);
The problem is that my globalization strings aren't being converted. I'm getting the <GlobalizedName> content istead of the value.
How get I get the compiled report to globalized?
After compiling the report, the assembly is removed from the AppDomain and it loaded with no rights. I found two solutions to that problem:
1) Changing the StiConfig.ApplicationDirectory to a temp folder and setting the everyone right on that folder. That is a workaround but still I don't like opening security like that
2) Compiling my report to a dll and adding that dll in reference to my MVC application.
The 2nd option is the best solution for me plus it speed's up the report generation by 3/4 of a second, not negligable for a web application. The only issue I'm getting with that (because it just couldn't work on the first shot) it globalization.
my globalisation code looks like this:
var stiReport = new global::Reports.Certificat_De_Mise_En_Réserve();
stiReport.GlobalizationManager = new GlobalizationManager(reportModel.ResourceType, culture);
stiReport.Render(false);
stiReport.ExportDocument(StiExportFormat.Pdf, filepath);
The problem is that my globalization strings aren't being converted. I'm getting the <GlobalizedName> content istead of the value.
How get I get the compiled report to globalized?
Re: UnauthorizedAccessException during report compilation
Hello.
So you need to compile report with each culture you use.
Thank you.
It's impossible to globalize compiled report. You should do it before compilation.allo_man wrote:How get I get the compiled report to globalized?
So you need to compile report with each culture you use.
Thank you.
Re: UnauthorizedAccessException during report compilation
How can I globalize them?
When I'm compiling the reports I'm running the thread in new CultureInfo("fr-ca"); and I'm compiling them using:
StiReport.CompileReportsToAssembly(targetAssembly, reports, StiReportLanguageType.CSharp);
But the report aren't in the correct language each label is showing the key part of the resx and not the value part.
Additional question: Is there a way to specify the namespace in wich the compiled reports will be created. I'm tried:
StiOptions.Engine.DefaultNamespace = Path.GetFileNameWithoutExtension(targetAssembly);
but it isn't working.
Regards
When I'm compiling the reports I'm running the thread in new CultureInfo("fr-ca"); and I'm compiling them using:
StiReport.CompileReportsToAssembly(targetAssembly, reports, StiReportLanguageType.CSharp);
But the report aren't in the correct language each label is showing the key part of the resx and not the value part.
Additional question: Is there a way to specify the namespace in wich the compiled reports will be created. I'm tried:
StiOptions.Engine.DefaultNamespace = Path.GetFileNameWithoutExtension(targetAssembly);
but it isn't working.
Regards
Re: UnauthorizedAccessException during report compilation
Hello.
Please, try to set next static option to avoid UnauthorizedAccessException.
How do you set Globalization before compilation?
Do you set GlobalizationManager property?
Thank you.
Please, try to set next static option to avoid UnauthorizedAccessException.
Code: Select all
StiOptions.Engine.AllowSetCurrentDirectory = false;
Do you set GlobalizationManager property?
Thank you.
Re: UnauthorizedAccessException during report compilation
I've tried the AllowSetCurrentDirectory to false. It was giving me another UnauthorizedAccessException furter down the code.
For the GlobalizationManager. I wasn't setting it. That solved my issue with globalization.
Is it possible to configure the namespace in witch the report is built?
For the GlobalizationManager. I wasn't setting it. That solved my issue with globalization.
Is it possible to configure the namespace in witch the report is built?
Re: UnauthorizedAccessException during report compilation
Hello.
It's impossible to change NameSpace of already created report.
Thank you.
You should use this code before creating a report.allo_man wrote:Is there a way to specify the namespace in wich the compiled reports will be created. I'm tried:
StiOptions.Engine.DefaultNamespace = Path.GetFileNameWithoutExtension(targetAssembly);
but it isn't working.
It's impossible to change NameSpace of already created report.
Thank you.