Request for the permission of type 'System.Security.Permissions.SecurityPermission,mscorlib,Version=4.0.0.0, Culture=neutral, PublicKeyToken='failed - reporting-services

background of what happened:
We had several reports on a report server version 2012 and we migrated all of them to a new report server version 2019.
Report with the issue:
One of the report hides some textboxes based on the roles the user has using "=not Code.Principal.IsInRole("ROLE_NAME")" in Visibility -> Hidden property. If the user is not in that group the textbox wont be visible.
This works fine on the old server.
However on the new server we get the error message:
"The Hidden expression for the rectangle 'RecAV' contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=123456' failed. (rsProcessingError)
The Hidden expression for the rectangle 'RecAV' contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=123456' failed. (rsRuntimeErrorInExpression)"
Normally it should look and see i'm not part of that role and just not display that rectangle.
Any suggestions on where should i start looking?
Thanks
Regards
if i remove =not Code.Principal.IsInRole("ROLE_NAME") then i dont get this error but we need to have it there to only allow users to access their own options.

Related

.ASPX: How do I restrict web access to logged on users only?

► Problem: Anyone can access a webpage, but I only want logged in users to be authorized to access it.
Background:
Web Server = IIS 8
Server OS = Windows Server 2012
Framework = .NET 4.5
Environment = .\WebFolder\logon.aspx, .\WebFolder\inside.html
Website = Simple logon page ("logon.aspx") that guards an html page ("inside.html").
Users = External people (ie, non-intranet)
Sample URLs:
A. "www.webpage.com/logon.aspx"
B. "www.webpage.com/inside.html"
Desired Outcome:
Everyone can access the "logon.aspx" page
Only logged on users can access the "inside.html" page
Any direct attempts to access "B" will trigger a redirect to "A"
No additional use of program code
Prior Attempts:
I've been fiddling with the web.config file (authentication & authorization), but to no avail (501 Server Error, 401 Authorization Error, Runtime Application Error).
Web.Config File:
<system.web>
<authentication>
<forms name=".ASPXFORMSAUTH" loginUrl="logon.aspx" protection="All" timeout="1" path="/" slidingExpiration="true" requireSSL="false" />
</authentication>
<authorization></authorization>
</system.web>
Bottom line: I'm sure this is a very basic/easy thing to configure, it's just that I haven't been able to do it so far. Plus, I do not want to write any additional code in order to accomplish a seemingly fundamental task.
Thanks in advance!
Okay, I figured it out (after 7 hours). It requires four things (based on the example file structure):
1. Using the FormsAuthentication module
VS2012 → Project → Your credentials/authentication code → Use FormsAuthentication.RedirectFromLogin(_var1_, _var2_) instead of Response.Redirect(inside.html)
2. Adding a new node in the web.config file
<system.webServer><handlers><add name="HTMLHandler" type="System.Web.StaticFileHandler" path="*.html" verb="GET" /></handlers>
3. Including the 'defaultUrl' attribute in the Forms tag
<forms name=".ASPXFORMSAUTH" loginUrl="logon.aspx" defaultUrl="inside.html" protection="All" timeout="1" path="/" slidingExpiration="false" requireSSL="false" />
4. Adding a location tag authorization restriction to the 'web.config' file
<location path="inside.html"><system.web><authorization><deny users="?" /></authorization></system.web></location>
See my comments (below) for an explanation of each of these four pieces.

Error while loading ssrs report

I got the following error while loading data using ssrs report:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error
occurred while processing the request on the server. The status code
returned from the server was: 12031
My Data is not large.
This error may be due to the HTTP Runtime limitation of the maxRequestLength. The default value is 4096.
Try adding (or editing) the following entry in your Web.Config:
"<httpRuntime maxRequestLength="8192" />"
(effectively allowing 8mb of data transmission, instead of the default 4mb).
You'll want to enter this in the System.Web configuration section.

Exchange 2010, Cannot ADD new user to Delivery Option, Set-Mailbox Failed, Error: Couldn't find object, Send on Behalf, isn't the expected type

Aim:
Try to add new user to "Delivery Options -> Send on Behalf -> Grant this permission to:".
This is found in:
Mailbox -> Properties -> Mail Flow Settings -> Delivery Options
Issue:
Failed to add new user to "Delivery Options"
Got error message
Error: Couldn't find object "DOMAINxxxx/OUxxxx/USERxxxx". Please make
sure that it was spelled correctly or specify a different object.
Reason: The recipient DOMAINxxxx/OUxxxx/USERxxxx isn't the expected
type.
But USERxxxx is NOT in the list of "Grant this permission
to"
Also USERxxxx is has already been DISABLED in Active Directory
Attempted Fix:
Confirmed PublicDelegates is set to "not set"
ADSI edit -> USERxxxx -> Properties -> PublicDelegates
Re-enabled USERxxxx account in Active Directory and then tried to ADD new user, still FAILED
Current Fix Result:
Exchange FAILED to add new user to "Delivery Options" even the "PublicDelegates" has no value in "ADSI edit"
Reference Picture of the issue:
I have found the issue.
Make sure to remove "PublicDelegates" from USERxxxx's account and also the mailbox you would like to add new account in.
Previously I removed "PublicDelegates" from USERxxxx's account only, therefore the issue was persistent.
Also once you removed the first USERxxxx from the error message, you might get another USERxxxx2 with same issue. In this case repeat the steps above until all error goes away, then you will be able to add new user in the mailbox.

Maximum request length exceeded exception

I'm trying to upload a 20 meg file using the upload control and it's working fine on visual studio's built in webserver but once I publish it to the production server (which I have no access to) I keep getting the following error :
Server Error in '/' Application.
--------------------------------------------------------------------------------
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.GetEntireRawContent() +11140903
System.Web.HttpRequest.GetMultipartContent() +72
System.Web.HttpRequest.FillInFormCollection() +245
System.Web.HttpRequest.get_Form() +119
System.Web.HttpRequest.get_HasForm() +11072199
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124
System.Web.UI.Page.DeterminePostBackMode() +83
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270
--------------------------------------------------------------------------------
I've added the following to my system.web node so i don't know what the real issue is.
<httpRuntime executionTimeout="800" maxRequestLength="51200" />
Any direction on this would be very helpful.
If config file change doesn't work, please try to update property httpRuntime executionTimeout="9200" maxRequestLength="200000"> directly from IIS.
For reference:
Although you have a 20Mb file, it is possible that encoding or other content on the page causes the 50Mb limit you have set to be exceeded. I recommend doubling your current setting.
There is also another web.config setting that could come into play: security request filtering maxAllowedContentLength.
This default to 30MB, but could be set differently in your environment.
The web.config entry would be something along the lines of:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1550000000" maxQueryString="16384" />
<fileExtensions>
<add fileExtension="." allowed="true" />
</fileExtensions>
</requestFiltering>
</security>

Error occured while trying to use Nservice bus

I am new to NServcie bus and Im was trying to implement Publication and subscription of messages .This is the error I'm getting
Exception when starting endpoint, error has been logged. Reason: The destination queue 'mygateway' could not be found. You may have misconfigured the destination for this kind of message (NServiceBus.Unicast.Transport.CompletionMessage) in the MessageEndpointMappings of the UnicastBusConfig section in your configuration file.It may also be the case that the given queue just hasn't been created yet, or has been deleted.
This is the configuration used that i used in app config
<MsmqTransportConfig
InputQueue="publisherqueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5" />
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="Messages"
Endpoint="mygateway" />
</MessageEndpointMappings>
</UnicastBusConfig>
<MsmqSubscriptionStorageConfig
Queue="GateWaySubscriptions" />
My question is why this "mygateway " queue is not automatically created ? Am i doing anything wrong ? Please help.
Thanks
Alex.
This app you are configuring for only "owns" (use that term loosely) the queues in MsmqTransportConfig, namely, "publisherqueue" and "error". These are the only queues it will attempt to create for you.
Your MessageEndpointMappings section defines "remote" queues, i.e. your desire to either send messages from Messages to mygateway, or subscribe to Messages from mygateway. Another endpoint, with "mygateway" as its input queue, would be responsible for it up.
So what your app is telling you is "I see that you're interested in exchanging messages with mygateway, but I knocked and nobody's home."