Jump to content
Xtreme .Net Talk

bri189a

Avatar/Signature
  • Posts

    1014
  • Joined

  • Last visited

Everything posted by bri189a

  1. 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!
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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!
  7. 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.
  8. 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
  9. 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!
  10. 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).
  11. 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.
  12. 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.
  13. 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'
  14. 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
  15. 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.
  16. The solution compiles fine, but when running I get a CS0012 error. The supposed missing reference is indeed referenced. This started occurring when added some implict operators...here's the scenerio: in namespace CompanyName.Whatever1 there is a class called X; in namespace CompanyName.Whatever2 there is also a class called X. These two classes our highly coupled (purposefully) but *are* indeed seperate objects (let's not get into this design, it's a problem that's being addressed). Anyway these two 'X' object have to be pretty interchangable so we're using implicit casting. This is all fine and well, and again works fine, but now at runtime when you go to create an instance of Whatever1.X you get CS0012 saying you need to add a reference to CompanyName.Whatever2.dll Verision 1.0.0.0 blah blah...and this is what is referenced in the assembly references!!! It compiles just fine, so I don't understand why we're getting the runtime error. I have a zip I can email that demonstrates the behavior if you think you can help. (too large to attach to post) Thanks
  17. I can't get this to work. Object Whatever implements interface IWhatever, this interface is used as the proxy in the GUI (web app) to talk to the concrete implementation on the app server. Using Console applications this works fine. I'm using WKO and configuring via remote, I'm using the TCP channel. When trying to use a web application as the client, the object is created of coarse (WKO isn't created on service host until first method is called) and this is where IIS freezes. Since everything works fine in Console test apps, I know it must be some sort of security and/or configuration issue. I've never had to deal with remoting outside of windows applications, so a situation like this is new to me. What am I missing.
  18. Just so you know, it's rarely mentioned, but between the method that threw the error and the global handler you can also override the Page OnError method so that you can handle errors for a page in a single location, sometimes you need something a little more fine grained than the global handler for a specific page.
  19. You have to put a iframe in the same position as the select tag underneath it and this will stop the bleed-through.
  20. If you're using 2.0 why don't you just post back to the referring page that way it could have access to the previous page variables? I wouldn't advise tying up session memory with specific page variables like this. Session is designed more for things that are global across the site for that user, such as there formal name ('John Doe' instead of their login of jdoe) or preferences. An old fashioned way of doing this (1.1 compliant) would be to post back to the page and instead of using Response.Redirect, use Server.Transfer and then you could use public properities of the original page that could be accessed by the new page through context (cast).
  21. I do ASP.NET normally, I'm doing a utility program that uses a DataGridView. The data (via a BoundDataSource) comes from an intra-department WebService. I've figured out that I can bind an event to the BoundDataSource_ListChanged event to detect when a cell has been updated and update data through that Web Service but the problem is that you often update several cells on the same row, so each time I move to a cell I'm calling an update method on the web service. It would be MUCH better to have a Row.BeginEdit() and Row.EndEdit() method, but there is no such thing. Hooking up to RowEnter and RowExit hasn't proved very useful. I'm sure a lot of this has to deal with the fact that I'm using to ASP.NET where you update and entire row at a time (not a cell) so your trips to a data store are minimized, but the WinForms version doesn't seem to want to let you edit an entire row at once. This is very frustrating, what am I doing wrong?
  22. Wasn't multi-threading. I can't give out the source code that does this, but I'm checking with a friend later this week to see if he can remember the exacts of how we got to occur elsewhere that was a lot simpler of a situation. I really think it has to do with the way a page is parsed and the internal page class is disposed. I mean ASPNET handling requests aren't all on the same thread, so that would be a possiblity maybe?
  23. You're right...can't possible happen, but I was trying to illustrate the symptoms...without sending the actual program I don't know how else to do it. But at least you saw an article too so I know I'm not crazy.
  24. I saw an article that explained why this happens, trying to find...does anyone know what I'm talking about: int index = 1; while(index < 10) { int i; if(index % 2) { i = index; } Console.WriteLine(i); index ++; } Worse case Output: 0 2 2 4 4 6 6 8 8 10 Let me stress that this isn't an exact output everytime - it's worse case...but make the loop big enough and let it run enough times and you'll see it. What I'm getting at is that occasionally you see these 'variable ghosts' when you code like this. I know not to do this because I've run into it before, but yesterday I had a co-worker who ran into a similiar variable where at the class level he had a boolean value that he wasn't explicitly setting to false when declaring it. This was on a asp code behind. This resulted in occasionally the variable still being set to true from a (recent) previous call to the page. He couldn't understand why this is happening; I know it has something to do with GC and finalization que, but I can't find the article for the life of me and he really wants to understand why this is happening, so if you know where it is or can give a better explanation that what I just did, let me know. Thanks
  25. I know Microsoft recommends what you wrote if your going to turn off that setting, they recommend leaving that setting on I believe. Those utility methods are pretty staight forward but it's one of those things if you have a bunch of controls you need to 'hand-roll validate' you really begin to wish .NET supported (natively) AOP.
×
×
  • Create New...