|
Before you think this is just another "How do I...?" please read. I DO NOT need to know how to do async operations. Here's my scenario...
I am performing Async callbacks on a Form to retrieve data on a seperate thread. I am using Delegates not Threads. First, I am not simply calling one Query and Oh, we're done. I kick off about 7 different delegates to load data from different sources. I am using "SyncLocks" or "lock" in C# with different Lock objects per data I am retrieving. One thing that is happening now is that users are CLOSING my form while data is still loading. Obviously, this causes numerous errors because the Callbacks do not have a UI thread to go back to.
My question is, how can I cancel an Async operation or gracefully exit running one?
|
|
|
|
|
Since executing a delegate asynchronously means that the target method executes on a thread from the CLR's thread pool, you will not have fine-grain control over the worker thread. If you need the ability to manipulate the worker thread you should explicitly create it.
Josh
|
|
|
|
|
Hi,
My apllication gives error when I try to open the oledb connection. "CreateActCtxW could not be located in the dynamic link library KERNEL32". This windows app is running on windows server 2000. But if I run on my client machine on Win XP, it runs fine. I am using com object for excel 9.0.
Can anyone please help ??
Thanks a lot!
|
|
|
|
|
Is the com object for excel 9.0 registered on the 2000 machine?
|
|
|
|
|
Yes, I belive so, otherwise I should have got the error that excel not registered error. I am using the COM interop for excel, Interop.Excel.dll
How do I find out if the COM is registered.
Thanks!!
|
|
|
|
|
I should have asked the question a little better. Is Excel installed on the windows 2000 server? If not this is your problem. If so what version? My guess is that the version's are different and the COM compenents support different methods.
I had this problem once a long time ago with VB6 and different versions of office installed on the clients machines, but I cannot remember the specific error message
Mike Lasseter
|
|
|
|
|
Thanks for your reply, I will look into the version.
Otherwise, excel is intalled on the server machine.
|
|
|
|
|
I tried the VB.NET forum, but maybe that was the wrong forum.
What I need to do is check what rights that the current authenticated user has
on a given file or directory. If the code needs to create a directory(sub-folder)
does the current user have Create rights. If the current user needs to write in a directory
do they have the Write permissions.
I have tried several renditions of the following which is from the Microsoft
Help section. This code seems add the access rule even when I don't have the rights
do this
TRY
Dim dInfo As New DirectoryInfo(FileName)
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()
dSecurity.AddAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))
dInfo.SetAccessControl(dSecurity)
CATCH
END TRY
|
|
|
|
|
Hi,
Dotnet Security is huge topic. I can just point you to the resource as such. Here is a good article.
http://www.codeproject.com/dotnet/UB_CAS_NET.asp
Permissions are based not only On Identity of User but also based on identity of code. So, If you want to give your code some permission You must assign certain Evidence to it which will be used to calculate Permission grantset during Policy Resolution. After all this Final Hurdle still remains. You OS should allow to write into that perticular directory.
Just try to make a custom permission which will allow you to write in directory and assign it to code. For that you need to run Mscorcfg.msc from VS Command prompt or run it from .net Framework 2.0 configuration from Administrative tools.
|
|
|
|
|
Well I did read the entire article and saw what was happening.
From everything I saw unless I was not doing it exactly, is that
one way to do what I want to do was to Create a permission set, then
add the appropriate rights to that permission set and then do a Permission
Set DEMAND on it. From his example though it seemed that if He wanted to then
check for Create rights he still had to go through the trouble of creating a
FileStream Object to see if he really had the rights to do the operation.
I have tried the following. Even if I have only Read access only to XPath that this code works
all the time, I can never generate a SecurityException Error.
TRY
DIM DirectoryName AS STRING = XPath
DIM PS As New PermissionSet(PermissionState.None)
PS.AddPermission(New FileIOPermission(FileIOPermissionAccess.Write, PATH.GetFullPath(XPath)))
PS.Demand()
RETURN TRUE
CATCH EX AS SecurityException
RETURN FALSE
CATCH EX As Exception
RETURN FALSE
END TRY
I also created a codegroup, and a permissionset using the .NET 2.0 configurator. That gives
unrestricted access to the Security, UIPermission, and the FileIOPermission objects. I just
want to tell if my current user can create in a given directory, or if they can read from a
given directory etc. Any further ideas as to why I cannot trap an error above?
|
|
|
|
|
Hi,
Sorry for late reply. I found that there is a class called DirectorySecurity. I think this is what you need.
http://msdn2.microsoft.com/en-US/library/system.security.accesscontrol.directorysecurity.aspx
You might know this, But this is just to remind that Demand() method just to perform Stack walk. That is used just to prevent the Elevation of Priviledge. When your method call some function in some other dll. So, That DLL may check your DLL by creating a instance of requested permission and compare it agaist all the methods in the call stack.
According to MSDN, If the Parent Directory is Readonly then when you try to create a directory in that it will give an exception. Here are the more cases when Exception is thrown. Just check if your directory is readonly??
I've played a lot with policy files, Because I am studying .NET security course at my school. And I suggest you can do the same if you want. But, Instead you can create a new permission file under user group and do not assign any permission to it except execution. Now you can create a code group and assign this permission only as a permission set. You also need to select two checkboxes from General tab. This will prevent any access to be given to the All_Code when this condition is met. Otherwise, Permission will be granted based on Union of all code groups at each policy level + intersection of all policy level.
|
|
|
|
|
How can I make the items in the report to have alternating gridlines?
e.g.
first line
second line
third line
fourth line
The lines with the strike trough should have a light grey background colour, and the other lines must have a white background colour.
Thanks
Cornelis
|
|
|
|
|
You can set the background of an area/field using an expression instead of a color value. Use something like this:
=IIF(RowNumber(Nothing) Mod 2 = 1, "LightGrey", "White")
JR
|
|
|
|
|
Dear All,
i build my application on Visual studio 2005 but the user only have
framework 1.0 how can i make my application portable to run on 1.0 and 2.0 in the same time
Regards,
Charbel Asmar
|
|
|
|
|
The best way is to force the user to download .NET 2.0
The maybe OK way is to build your program under 1.1 and under 2.0
The lame way is to force VS2005 to work with 1.1.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi all,
I have been able to create a publisher policy for .NET .EXE applications using the .NET framework 2.0 configuration tool. I cannot seem to do the same for .NET DLLs.
More specifically, I would like to have either a .config file for my main DLL or a publisher policy DLL for my main DLL to instruct it to load alternate versions of helper .NET DLL assembly references at runtime if the ones it was compiled against aren't available. All of my assemblies are strong named and in the GAC.
Is this even possible? I cannot seem to find a straight answer on this. Am I thinking about the problem the wrong way entirely?
Thanks,
Steve
|
|
|
|
|
Can Visual Studio 2003 and Visual Studio 2005 run on the same machine?
|
|
|
|
|
|
yes
Kindly send me feedback
Thanking you,
Raghuvarma.
|
|
|
|
|
Is it possible to convert from .net 2.0 to .net 1.1.
and how is it done in an easy way ?
|
|
|
|
|
That depends on what you mean by "convert".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
As long you haven't used any specific 2.0 classes or functions, then yes!
Generic collections can be replaced by their non-generic counterpart.
Graham
|
|
|
|
|
ok thanks you.
do you know if there is an easy way to it. any tools ?
i have tried google it but cant seems to finde anything
|
|
|
|
|
Personally I don't know of any specific tool, but if you haven't used any of the 2.0 features, then it should be as easy as running the 1.1 compiler over the sources.
Partial classes are easy enough to remove, by merging all the seperate sources files into one.
Where you have used implicit (sp?) event handlers, replace it with a explicit declaration. E.g.
replace Control.Click+=Function with Control.Click+=new EventHandler(Function)
If you have used any of the generic collections then you just replace it with the non-generic version. It should be as easy as replacing the declaration call, as between the two methods/properties should be the same. E.g. List<T> is the generic version of ArrayList
Where it can get complicated is where you have used generics in other places. To remove it could involve refactoring code again.
Graham.
-- modified at 20:18 Sunday 30th April, 2006
|
|
|
|
|