|
emission wrote:
Is there no overhead when converting, i.e using ((IBaseObject)Dog).baseobject instead of directly accessing a public Dog.baseobject?
Negligable. A cast is an instruction that must be processed but compared to boxing operations these are trivial.
emission wrote:
However, this time it's more a design issue than a security issue, and I just curiously wonder about the reasons behind.
No one said that CAS has to be used only for security. Even the term "security" is rather loose. If security means that you don't want other developers via their assemblies to "see" or even access the member than CAS is what you want. Even with explicit interface implementations (i.e., what you're currently doing) a coder merely has to cast to the interface. Even if you used the BrowsableAttribute or EditorVisibilityAttribute you're only hiding it. The only way to truly deny access to the member is CAS.
In .NET 2.0 a new attribute - InternalsVisibleToAttribute[^] - allows compilers to compile code that accesses internal members from another assembly.
emission wrote:
internal int IAnimal.Age
That would be a voilation. Besides, when you compile this the member is actually private , much more strict than your internal access modifier. The thing is that your object must be cast to an interface object on which the member is truly called, which must be public . The interface object references your object, however, so your private member is not access directly.
You can learn more about implicit and explicit interfaces at http://msdn.microsoft.com/library/en-us/csspec/html/vclrfcsharpspec_13_4_1.asp[^] (C# Language Specification).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks! The Language Specification cleared things up.
The solution I'll use is (now that I realize that I can have both an explicit implementation of the interface and a non-interfaced member.
<br />
object IBaseObject.baseobject<br />
{<br />
get<br />
{<br />
return _baseobject;<br />
}<br />
}<br />
<br />
internal object baseobject<br />
{<br />
get<br />
{<br />
return _baseobject;<br />
}<br />
}<br />
|
|
|
|
|
Debugging has been diabled for the c# web projects. How can i enable debugging?
|
|
|
|
|
It would actually be disabled for ASP.NET projects (when compiled, the source language hardly matters which is the whole point of the Common Language Infrastructure, or CLI).
While this belongs in the ASP.NET forum I'll direct you this time to http://support.microsoft.com/search/default.aspx?catalog=LCID%3D1033&query=debugging+ASP.NET+web+applications[^], which describes many differents reasons that is is disabled and how to re-enable it.
In the future, please direct all ASP.NET-related questions to the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
Does anyone know how to create an MS installer of V. C# application from another V. C# application (when I click on a btton, the MS Installer of the other application is created).
Please Help.
|
|
|
|
|
Why would you have one install create another? Please explain exactly what it is you're trying to do.
If you're question is simply about how to create a Windows Installer package (MSI) using VS.NEt, read Introduction to Windows Installer[^] in the VS.NET product documentation and follow the links in the table of contents.
For more in-depth information as well as how to manually edit the MSI package using Orca (a tool within the MSI SDK), see the MSI SDK documentation online at http://msdn.microsoft.com/library/en-us/msi/setup/windows_installer_start_page.asp[^].
Note that the installer projects in VS.NET are very limited.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Debugging for my c# projects has been diabled. How can I enable the projects for debugging?
|
|
|
|
|
1. In VS.NET, open the Build menu, select Configuration Manager, then change the Configuration column value for your project to Debug.
2. Find and then completely read a good tutorial on using VS.NET.
Here's a good start:
http://www.learnvisualstudio.com
John Hebert
Solvitur Ambulando
|
|
|
|
|
Hello boarders,
How to list a files in a particular directory at the client side?
I need to give a user interface to access the files of a particular folder by using windows user control in a web page.
Any help would be highly appreciated
Thanks,
Sreenath
|
|
|
|
|
It's really a matter of permissions. Code Access Security grants assemblies based on their evidence a certain set of permissions or unlimited access. You need to make sure that users grant such permissions to your assemblies using certain host-based evidence (assembly evidence besides strong-name identities are not supported for Internet-deployed assemblies), which you can do using a Windows Installer package to execute an Installer class derivative you would define to create a code group, or give them a batch file to run caspol.exe (depending on your confidence in the users' abilities).
For more about this and about scripting controls (in order to easily provide feedback in the web page itself) see an old article of mine at http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388[^].
If you have any questions about that article continue them on this thread since I haven't used that site - and don't plan to - in many years.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Stewart,
I got the solution. Thanks for your valuable input. I appreciate it.
I recreated windows control library and added URL as an evidence with permission such as FileIO and Assembly execution. It is working perfectly.
Now I need to give msi file to the client. This msi file should create a code group and permission set. Any idea of how to use the installer package? with the installation it should have created necessary code groups and permission sets.
Sreenath
|
|
|
|
|
I have created a windows control library which contains several form controls. This libaray is being registered on the web page using <object> tag
Eg.,
<OBJECT id=HelloWorldControl1 classid="http://localhost/NBCCtrlLib/NBCControlLib.dll#devhood.rtfcontrol" VIEWASTEXT width=500 height=500></OBJECT>
When client access the web page I have created I should be able to access/read the client hard disk.
Let me know,
Any ideas would def help me.
Thanks,
Sreenath
|
|
|
|
|
|
Based on host evidence and strong name identity evidence the assembly must be granted permissions to run. In .NET 1.0 the Internet zone was granted no permissions, and in 1.1 was granted very few permissions.
Read Understanding .NET Code Access Security[^] for information about CAS and how to adjust your permissions.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Could anyone provide me with a simple C#'s client/server application. I am into socket programming with TCP/IP as my protocol.. Thanks in advance.
----------------------
Seeing the infinite...
|
|
|
|
|
Have you tried searching CodeProject?
http://www.codeproject.com/info/search.asp?cats=3&cats=4&cats=5&searchkw=socket+client+server&author=&sd=11%2F15%2F1999&ed=1%2F17%2F2005
|
|
|
|
|
Thanks Robert!!!
----------------------
Seeing the infinite...
|
|
|
|
|
Hi,
Does anyone know how to get the total commit charge of a system using c#?
Thanks
|
|
|
|
|
Can you describe what you mean by "commit charge"? That's rather ambiquous.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I meant, the total memory that is being used by the system (Virtual and Physical).
As is shown by Task Manager.
|
|
|
|
|
On NT you can use counters to query this information. Read about the PerformanceCounter[^] class in the .NET Framework SDK.
This works great in VS.NET where you can create instances of PerformanceCounter simply by using the Server Explorer to browse the performance counters and drag and drop the one you want onto the designer. You can do the same thing manually, of course, since the designer (for the most part) utilizes CodeDom serializers implements in the Framework.
WMI - via the System.Management namespace classes - can also query for this information but is not as robust compared to performance counters in this case.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello
I want to find if a directory inherits of another parent directory.
For example in Windows, by clicking the right button of the mouse in a directory, after clicking on "Security" it's possible to know if the current directory inherits of the rigth of a parent directory.
How to find that ? I guess that this information is stored in wmi but I didn't find where.
Thanks in advance for your help !
|
|
|
|
|
please
|
|
|
|
|
|
Hi every one
I need a help in JPEG image processing with C# language ,I need to know how can I read the jpeg file bit’s in the stream wile it compressed and get from it each pixel value in jpeg pixel format and then convert this pixel from jpeg format into RGB format and return it for the jpeg format ,if that is possible.
I really need a help on this I search a lot for this but nothing I get ,if any one have any idea or resource about this problem pleas tell me about it ,if you can.
memo
|
|
|
|