OleDbPermission in ASP.NET 4.0

Support is not able to solve OleDbPermission issue on ASP.NET 4.0 site since 30 hours.
See ticket [JH #IUY-56247-654].

Please someone senior look into this:

error is

System.Security.SecurityException: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessSecurityEngine.Check(PermissionSet permSet, StackCrawlMark& stackMark) at System.Security.PermissionSet.Demand() at System.Data.Common.DbConnectionOptions.DemandPermission() at System.Data.OleDb.OleDbConnection.PermissionDemand() at System.Data.OleDb.OleDbConnectionFactory.PermissionDemand(DbConnection outerConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open()

This required editing of trust level which required input from Manish or myself, and it is done now.

Thank you Stephen, it is working now. Wish i had posted query here earlier, then i had not needed to wait for 34 hours.

But doesn’t support staff know anything about it?, i need to give a lot explanation it is not code issue, it requires change in config.
I has also sited old support ticket for the exactly same query on another server which was solved by Manish (also given name of Manish, saying he can solve it), also given link form MSDN what need to change where, but support staff keep raising questions on my code, instead of talking to senior.

Though i hardly need to raise support queries, thanks to hard work of admins servers work fine, but this was not good support experience.

Posting here would not have done much good.
I had my nose in Hyper-V deployment issues yesterday and just escaped to breathe this morning.

This issue was actually the 4.0 part, for some reason when it was mentioned to me yesterday it was checked on 2.0 config, not 4.0. 2.0 has been having oledbpermissions for…years.

We are not developers, and on weekend the developers are not in office to even ask a question. We get many developers that think they know it all (and I am not saying this about you) and what is safe and not, and dont understand the risks.

There is no issue in this permissions, but some others while there code may be 100% secure and all, the permission itself can open many issues on a shared server, for OTHER code.

Edit to add: and Manish was on his weekly off, just came into shift.

Hi Stefan, I have same issue again for another server, it is also ASP.NET 4.0.
Please see ticket [JH #NPR-77875-924].
i think you only can fix it.

It is already configured.

OleDBPermissions are in the config, and unrestricted allowed. (in 4.0 32bit and x64)
Many people are having issues with it if you check on google. Is there any alternative means?

I am talking about on win12 2008 server specifically, it seems that the same lines worked on others, aren’t working on 2008 :frowning:

when akshay replied I gave him a direct copy of the lines from the config, I also changed one aspect just to check if it worked, and seems it did no good.

[code]






















                </SecurityClasses>[/code]

This is the full security classes section and below are the only sections with changes from default hightrust config on asp.net 4.0 in ipermission’s:

<IPermission class="ReflectionPermission" version="1" Flags="ReflectionEmit, RestrictedMemberAccess" /> <IPermission class="RegistryPermission" version="1" Unrestricted="true" /> <IPermission class="SecurityPermission" version="1" Flags="Execution, ControlThread, ControlPrincipal, RemotingConfiguration" /> <IPermission class="SmtpPermission" version="1" Access="ConnectToUnrestrictedPort" /> <IPermission class="SocketPermission" version="1" Unrestricted="true" /> <IPermission class="SqlClientPermission" version="1" Unrestricted="true" /> <IPermission class="TypeDescriptorPermission" version="1" Unrestricted="true" /> <IPermission class="WebPermission" version="1" Unrestricted="true" /> <IPermission class="OleDbPermision" version="1" Unrestricted="true" />

I would have loved to be on Windows 2008 and take advantage of its IIS integration mode in future coding.
But for now making code working is on priority hence choosing to move to windows 2003 server.

Please keep searching solution for it.

Thanks.

Yes, we’ll be on the lookout for the fix on that, your account is going to 2003 in the short term.

It is more than 14 hours since transfer, still the site is down and no updates on ticket.
Please let me know how long it is going to take, i need to update client.

Moves can take up to 24 hours.

Actually it was there just no index page set.

thank you, but my issue is still open, on win13 too it shows same error:

System.Security.SecurityException: Request for the permission of type ‘System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

It looks like the only difference is adding odbcpermission line makes it work…this is an odd one but checking to see if it fixes on w2k8 now as well.

yes it is working now on win13.
How will you test it for win12 now as site moved to win13? if require i can prepare test code which you can try on any domain.

that will be fine, make a test code and zip it up on win13 for us and we will check it on win12 and win11 both :slight_smile:

Thanks

Find attached zip, extract and copy both files to any domain having ASP.NET support, and view TestExcel.aspx file in browser.

It will allow to upload .xls (Excel 97-2003 format) file and display its content if OleDbPermission is available.
It also require write access to App_Data folder, if it does not exists create folder first.

TestExcel.zip (1.87 KB)