|
Hi!
I think you should not use SecurityAction.Deny for your class and method but SecurityAction.LinkDemand .
That way, only the direct caller has to satisfy the strong name identity with the given public key, but callers further up the line don't have to.
If you use SecurityAction.Demand , then you'll always get a SecurityException because mscorlib (which is the top-most caller in the end) doesn't have the required strong name identity.
Hope this helps...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Well I have change the SecurityAction into SecurityAction.LinkDemand but still the console application that I use to test can access the class and the method. At application console I didn't set any Strong Name Key. So the theory is that the console application doesn't have any Strong Name Key (not the same key too) will caught an exception while access the library class that have been set a public key. Its that right or not. Because I want to protect my library that contains class and methods so that only I can use the class not the other people that want to reference my assembly.
Do you know how to solve this ?
PS: Can do this at Debug Mode for building the library ?
Thanks.
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
I created a test solution with VS2003/.NET 1.1 to experiment with the attributes and get exactly the same behavior with an Windows Forms application and a console application.
When I specify LinkDemand as action, then every caller that's not signed or does not expose the given public key will throw a security exception when trying to access the protected class.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Well it seem that everyone that use VS 2003 and FW 1.1 always success. But I don't close the conversation only for VS 2003.
Well if you have any solution or links to protect the assembly over FW 2.0 please tell me. I don't want to go back into VS 2003 because many of my jobs writen over VS 2005.
Thanks for you support.
Happy coding, ya..
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
Ok, it seems to be an issue with .NET 2.0 indeed.
I've converted the VS 2003 test solution to VS 2005 and tried again. I could reproduce the failure to check the StringNameIdentityPermissionAttribute with .NET 2.0 - the very same application that threw a SecurityException with 1.1 ran without problems in 2.0!
I think it's time to contact MS...
Regards,
mav
--
Black holes are the places where god divided by 0...
-- modified at 12:57 Tuesday 28th February, 2006
I just found some additional information that might be of interest:
In the microsoft.public.dotnet.security newsgroup I found a statement that in .NET 2.0 fully trusted code will automatically bypass all identity permission demands.
Heaven knows why this decision has been made, but this seems to explain the behaviour.
-- modified at 13:12 Tuesday 28th February, 2006
And another piece of wisdom from Eugene Bobukh:
http://blogs.msdn.com/eugene_bobukh/archive/2005/05/06/415217.aspx[^]
|
|
|
|
|
I'm writing some C++ code that I'd like to prepare for simple interop. To make things as easy as possible on the .NET side of things, how should I declare a C++ function that:
1. takes an array as a parameter? Is int* ok?
2. returns a UTF8 string. Is LPSTR ok? Should I use an output parameter instead of a return value?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
How do you intend to interop it, managed C++ or COM ? If managed C++, you'll end up writing methods that take .NET types anyhow.
I guess there is also pinvoke.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah I was planning PInvoke simply because there is an existing codebase (I'm trying to port some Java JNI code into the .NET world). I considered using C++/CLI to make it simpler, and may end up going that way, but for now I've just declared the methods as described in my first post.
So any thoughts on how to define a C method that takes an int[] and returns a string so that it can be used easily from a .NET language?
|
|
|
|
|
Judah Himango wrote: 1. takes an array as a parameter? Is int* ok?
Yes.
Judah Himango wrote: 2. returns a UTF8 string. Is LPSTR ok? Should I use an output parameter instead of a return value?
It is ok, as long as the calling application doesn't have to free or delete the memory.
I don't see dead pixels anymore...
Yes, even I am blogging now!
|
|
|
|
|
Thanks Daniel. The calling app would have to free the memory, so I think what I'll do instead is have the method take a 2nd LPSTR parameter which will be the output. That way I can feed in a StringBuilder and have it work without issue.
|
|
|
|
|
Will an event be raised when all the controls in a form has been drawn?
I have a form with many buttons with BGpics in it. Can I set the form to invisible, let it load all the pic, and then show it instead of it showing it and loading the pic at the same time (this makes it look really laggy)
|
|
|
|
|
If a control is not visible, and its background image is changed, will the image actually change? or will it only change only when it becomes visible?
|
|
|
|
|
That depends on how you specify "the image".
If the control is not visible, there is no background image drawn. If you change the property for the background image, the property changes, but as the property is not used as an image, the image can't change.
---
b { font-weight: normal; }
|
|
|
|
|
If a tree falls in the woods, and no-one is there to hear it...
If the control is not rendered, then no image is drawn.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes it will. But you won't see the change until you make the control visible.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
That means that if I have a number of pictures changed but not visible, it has potential to slow down the foreground performance right?
|
|
|
|
|
Yes, your app will take a performance hit every time you change (i.e. read) a new image (assuming you're reading them from a file).
A simple work-around would be to only remember the new image name everytime you "change" it. Then, when the control shows itself, it should load the current image (if it hasn't already done so) and set it as its background.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
How would I go about creating my own file format for an application?
Any help is appreciated
Wacky waving inflateable arm flailing tube man!
- Family Guy
|
|
|
|
|
Come up with three letters that are not commonly used ( not .doc for example ), then write the code to store relevant data to a file, and read it again.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sean89 wrote: How would I go about creating my own file format for an application?
Like Christian said, pick an uncommon extension, and use any file reading and writing mechanisms you want. For maximum efficiency, pick a file type that has lots of existing library support (like Xml or MDB), and use that file type with an uncommon extension.
Your files look like "ABC" files in explorer, but your app knows that they're really XML or Access database files when it goes to read and write them.
Share and enjoy.
Sean
|
|
|
|
|
Hi
I'm use using HttpWebRequest and HttpWebResponse to get a big xml file (about 10mb) from the web.
Now I want to parse this file and store it to the hard drive at the same time.
Problem:
When I store it first, then load it via TextReader it takes to long.
When I parse it directly via XmlTextReader, I can't save it to the hard drive any more.
Any idea, how to manage this problem? Properbly by filling an memoryStream?
Thanks
Paul
|
|
|
|
|
use the XmlTextReader, and as you parse the file, use a XmlTextWriter to save it on disk.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
i want to run my program in background.it functions like that when it found a new file HTML or PDF on harddrive.it is activated and default screen of my programs become visible to user.if any one have any idea of doing so then plz help!!!Thank you
|
|
|
|
|
Hi
i had a problem with connecting to my Data Base on the server but after giving my user the permissions it works.
Now i have a problem, when i doing an SQL Query on the table(select * from Users) i get the answer with the Query Analyzer.
when i am writing it in the source code with C# i get this error message:
"SELECT permission denied on object 'Users', database 'RTQ', owner 'dbo'. "
the exeption comes from this function:
myDataAdapter.Fill(myDataSet,"Users");
the hole code is :
mycon = new SqlConnection("Data Source=localhost;Database=RTQ;Integrated Security=SSPI");
mycon.Open();
myDataAdapter = new SqlDataAdapter("select * from Users",mycon);
myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet,"Users");
mycon.Close();
Why is that????
Thanks you all
|
|
|
|
|
Does the user have SELECT permissions?
|
|
|
|