Let me again state for the record that I don’t know what I’m doing. The only hope I hold out is that I know I can RTFM like nobody else can. It looks like I’ve got a lotta reading to do in order to catch up.
I’m working on installing some aspnet components on our Sharepoint dev server. Right off the bat I will point out that you cannot really put anything into the sharepoint web root and expect to see it in a browser. It seems like a security constraint they’ve put up which prevents me from doing this. So maybe the next best thing is to just create another app underneath the sharepoint app. At least, this is what I’m trying out right now. I am able to get things to run but I just encountered a very strange error message that goes a little like this:
System.Security.SecurityException: Request for the permission of type ‘System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
Probably because what I am doing is so very wrong. Any of you knuckleheads out there know what to do about this?
Speaking of very very wrong things, ask me about what I did on Friday night…
Update: I think that I was able to work my way out of this problem by adding in some attributes to a class file. It might have been something resembling this. Or it may have started working when I dropped my DLL into the GAC. Either way I am facing this issue once more and will try to make note of the solution to the problem here.
Meh…that didn’t seem to fix anything. Trying the GAC install technique instead…
GAC installation did not help things either!!! In order to do this you drop your .dll file into c:\windows\assembly and then you add in a line of XML to your web.config file, in the section like this:
Update Again: If you think that changing your web.config’s
element from
to
, you would be fucking wrong.
I’ve also tried to setup some custom code access levels in the .NET Config Wizard. This didn’t fix anything.
I broke down and made a windows application which calls my test dll. This seems to indicate that this inability to make DB calls from the dll is a problem exclusive to the web application. It might be a sharepoint thing or not. My next test is to make a plain vanilla webapp and try calling the dll from there.
It worked. So I know now that there’s no inherent inability to do this kind of operation. I guess it’s something to do with sharepoint, or the web.config of my sharepoint application. I don’t know which yet, but I am going to try to find out.
I am looking at the WSS policy files right now…I set the
element in web.config to WSS_Medium for both the public-facing fba site and the internal win-nt sites and still no luck. I will try to give permissions in SQL Mgmt Console to the WSS_WPG and see if this helps. It seems like this works. It’s one of these users, IUSR_<machine_name>, IIS_WPG, or WSS_WPG…going to find out which one thru divide & conquer…it looks like the winner is IUSR_<machine_name>.
I’m glad that is over with. But it didn’t end just yet…
I changed the web.config to reset the trust level to WSS_Minimal and this got me into trouble again. I also removed my DLL from the GAC, but it seems to be fine with that, so long as you’ve got the DLL specified in your web.config it will look for the file in /bin and load it up. But you cannot make this kind of sql call through the smartpart->user control with the trust level set at WSS_Minimal, you must use WSS_Medium.
Strong Named Assemblies »« Forms Based Authentication