bri189a
Avatar/Signature-
Posts
1014 -
Joined
-
Last visited
bri189a's Achievements
Newbie (1/14)
0
Reputation
-
So I know how to safely create the runtime my question gets into workflow instances. When you call instance.Start() it gets executed on another thread; more than likely this WF isn't going to be instant, so you need to wait for the completed event, but to do this without having the page already render to the client you have to use the whole AutoResetEvent.WaitOne() and the release method on the completed method. Well it doesn't take a genius to figure out what's going to happen if 50 people are concurrently using the web application and are in different parts of a work-flow - the site is going to crawl. So it seems this thread pausing method, while needed for windows apps, isn't desirable for web apps; what is the best practice for this then? You don't want to lose sight of the workflow by the page rendering before the workflow is complete; but at the same time you don't want to pause the execution thread of ASP.NET making everyone else wait while these workflows complete. In my tests, 2 users didn't seem to be a problem - my timer which would block the WF would allow the second user to work, but then once I got a third user started the first user was still blocking, and now the second was in a WF that was blocking, and the third just sat there waiting for the site to load up. Once the first user finished, ASP was unblocked and the third user could continue. This is the behavior I would expect - they don't say 'don't mess with the thread in web apps' for a reason; but I always like to blow things up to see what will happen. Anyway...so how are we suppose to do this in the web world? Links, suggestions, welcome. Thanks!
-
I have global themes that are not working; I'm lost...I'm looking for any ideas. The themes are installed to the following on IIS6: Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\Themes Everything works locally on my box. Any ideas? Message I get of coarse is: Theme 'Default' cannot be found in the application or global theme directories.
-
Thanks PD...the code project link was exactly what I needed. Good re-usable class that has comments and implements disposing...nice to see good contributions like that.
-
I'm not sure the best way to do this. I need to write some unit tests that test that certain users have the ability to do certain things; the objects have role based permissions. The problem is that in order to do this I have to impersonate one of 4 test users to get the permission set that is going to be tested. While impersonating myself is quite easy I can't find any .NET libraries that allow me to create a Windows identity/principal and make the unit test run in the context of that user. Any ideas would be greatly appreciated. I'd prefer not to hit the Windows API's if possible; if that is the only solution, a pointer to someone who has already wrapped LogonUser or whatever it is (don't remember) would great.
-
So at the assembly level to notify callers immediately if you need to have access to certain permission sets you have three flags you can use: RequestMinimum, RequestOptional, and RequestRefuse. So say your assembly is a signed assembly in the GAC (or maybe it's just strongly named) with AllowedPartiallTrustedCallers. Part of what your assembly does internally requires reflection. If you put [[assembly: ReflectionPermission(SecurityAction.RequestMinimum, Unrestricted=true)] in your assembly, this means calling assemblies will have to have that permission right? So what if from the sys-admin view, you give this GAC'd assembly full-trust, but you give this unassigned assembly Execute permission set; well when loading the assembly (the private untrusted assembly) you're going to get an error because of the assembly level reflection permission attribute on it's referenced assembly to the GAC'd item (heck even if it wasn't GAC'd and just signed you'd have this) - which isn't valid because the calling assembly (the private untrusted assembly) doesn't need reflection permission, just the GAC'd assembly does. So how would you do the equivelant of SecurityAction.Assert for the ReflectionPermission attribute at the assembly level to accomplish this? Or is this just not possible and callers will just have to find out at run-time 20 minutes into a workflow where they call a method that is using reflection to find this out? Hope what I'm asking is making sense.
-
Re: Declarative code access permissions Yeah, I happened across a CodeProject article that pointed out to me that only three of those 8 or 9 flags are applicable at the assembly level, and that's exactly what it was. As usual it takes two people from across the pond to show a Yank how to use security properly :) Thanks guys!
-
I'm trying to ensure that the calling assembly has reflection permissions prior to the user getting deep into the program and calling a method that requires it only to find they don't have it and losing they're work. I should be using code access security to do this, this is similiar to the example from MSDN on why to use CAS: The problem is that at the assembly level the only thing I seem to be able to check in the SecurityAttribute: [[assembly: SecurityPermission(SecurityAction.RequestMinimum)] But reading the rest of MSDN example your left with the impression that you can, and should, use any requests for permissions you need at the assembly level to raise errors when the assembly is loaded rather than down the line: So when I apply the below attribute: [[assembly: ReflectionPermission(SecurityAction.Assert)] I get the following compiler error: Assembly generation failed -- SecurityAction type invalid on assembly. So I said to myself, okay, maybe putting this attributes over the method, or the class level, when compiled into the assembly will somehow make these CAS policies checked when loading the assembly; I wrote a test app for that and unfortunately I could continue until I hit that code, which at that point I'm the frustrated user demonstrated in MSDN example. So is there something wrong with my syntax? Am I misunderstanding something about CAS? I'm having trouble finding examples and people who are knowledgable about CAS - which if you think about is scarey; so I'm hoping someone here knows a bit. Thanks.
-
I'm trying to do some work that calls native methods...a lot of time I can find an example somewhere that will help me to know what the values of constants and the such are (such as MB_OKCANCEL)...but many times I cannot. Is there a source to find these values when they are not on MSDN or in the PSDK? Thanks
-
I know this is ancient, but I was searching for how to do a simple wav playback myself (DirectSound or whatever it is I think would be sledge hammer for what I'm doing).... So for those of you who prefer C# over VB, you can use System.Media.SoundPlayer for this rather than the 'My' namespace...thanks Lutz!
-
One quick final question. If I have versions 2.0.0.0, 2.0.1.0, and 2.0.2.0 out in production and I have bug fixes in 2.0.3.0 is this right: oldVersion="2.0.0.0-2.0.2.0" newVersion="2.0.3.0" in order for the first 3 to point to the bug fixes (backward compatibility in mind in the code of coarse).
-
The problem was that the xml namespace attribute was missing from the assemblyBinding element, it should be xmlns="urn:schemas-microsoft-com:asm.v1" I would've though that the fuslogvw utility would of picked something like that up and I find it frustrating that it was something so simple. But now I know. Thanks for you help PD, having the assembly point to 1.0 instead of 1.1 was defintley a part of it too. Also, you're right the public key token was part of it too, I had forgotton to recompile with the right key...but I thought I had updated the post before you had looked at it.
-
Changing the policy dll to the right version fixed the fact that it wasn't even looking for the publisher policy...now it is, but it's still returning the original (see log): *** Assembly Binder Log Entry (4/2/2007 @ 9:40:42 AM) *** The operation was successful. Bind result: hr = 0x0. The operation completed successfully. Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running under executable C:\Visual Studio 2005\Projects\Test\GAC Testing\TestGacAssembly\v 1.0.0.0\Test Console App.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = ******** LOG: DisplayName = TestGacAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=97f6fa8856473f86 (Fully-specified) LOG: Appbase = file:///C:/Visual Studio 2005/Projects/Test/GAC Testing/TestGacAssembly/v 1.0.0.0/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Test Console App.exe Calling assembly : Test Console App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Publisher policy file is found at C:\WINDOWS\assembly\GAC_32\policy.1.0.TestGacAssembly\1.0.0.0__97f6fa8856473f86\policy.1.0.TestGacAssembly.config. LOG: Post-policy reference: TestGacAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=97f6fa8856473f86 LOG: Found assembly by looking in the GAC. LOG: Binding succeeds. Returns assembly from C:\WINDOWS\assembly\GAC_32\TestGacAssembly\1.0.0.0__97f6fa8856473f86\TestGacAssembly.dll. LOG: Assembly is loaded in default load context. Perhaps I have something wrong in my config file...that's the only thing I can think: <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding> <dependentAssembly> <assemblyIdentity name="TestGacAssembly" publicKeyToken="97f6fa8856473f86" /> <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> If you don't see anything there I'll zip up everything, but at this point it looks like the problem is narrowed down pretty much to the wrong assembly being returned since the log says the policy is found.
-
Thanks PD, I've tried both 1.0 and 1.1 originally just for luck but as stated above neither worked. I am using the same key for both assembly and publisher policy. I'm calling: al /link:TestAssembly.config /out:policy.1.0.TestAssembly.dll /keyf:MyKey.snk When I've examined the assembly in reflector it has indeed the configuration information: <?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding> <dependentAssembly> <assemblyIdentity name="TestAssembly" publicKeyToken="219ef380c9348a38" /> <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0"/> <!-- I've tried without the below too since this is the default --> <publisherPolicy apply="yes" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> I can see the assembly in the GAC. Whatever I'm doing wrong is something very minimal and trivial but is breaking my back. I can zip up the files tomorrow if you'd like to take a look and send screen shots of the cmd line calls. I'm really stumped here on this, I just know it's something plain as the nose on my face but I just can't seem to figure it out. Thanks again for your help. ***Oh and the tool I was talking about, from the cmd line it's 'fuslogvw'
-
I think Microsoft has some white papers on this too. But at minimum this should help: http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032283362&EventCategory=5&culture=en-US&CountryCode=US
-
I'm stuck. I haven't been stuck for a while. Manually doing a publisher policy in GUI tool works fine, but I'm trying to make a publisher policy assembly. I have a test app that I'm working with for simplicity. version 1.0.0.0 is deployed to GAC. my test console app is using version 1.0.0.0 returning a string ("Hello World") version 1.1.0.0 modifies the string to "Hello Everyone" Again, when manually doing publisher policy when I run the test program I get "Hello Everyone" and when view the 'fusion?' program (the one used for debugging binding) it shows the policy being found at the machine level and returns the right assembly (1.1.0.0) from the GAC. Now when I create a config file and create the policy through the al tool (as seen in so many books/blogs/forums) everything compiles. (I've checked my config file for errors and can't find any). I then use the gacutil tool to put this into the GAC and it shows up there nice and pretty. Oh, and I do have it named policy.1.1.TestAssembly as required (I also did policy.1.0.TestAssembly just in-case there's some weird thing, but I'm pretty sure it should be 1.1). I have also ensure I'm using the same SN key that the main assemblies are signed with (I saw a post where that could be a problem, but I don't see how, but I tried anyway) and have made sure to have the same processor specification when using the al tool (another post where I saw this could be a problem, but again, don't see how). But now when I run (after remove the manually created policy if I had that in there at the time) I continue to get 'Hello World'. Looking at the fusion utility the framework isn't even looking for a publisher policy. Now all the examples I've come across are for 1.1 framework; haven't seen any for 2.0 framework expect that which is in a book of mine; but the code is the same there. I am absolutely stumped to what I'm missing. I can send all my test files if needed later this weekend. Thanks so much.