|
I've created a very, very simple custom CodeAccessPermission class. It basically does nothing more than override the necessary base class methods and implement IUnrestrictedPermission.
In another class, I want to perform an imperative security check to ensure the caller has been granted my custom permission:
<br />
public static void ReadData()<br />
{<br />
CustomPermission MyPermission = <br />
new CustomPermission(PermissionState.Unrestricted);<br />
MyPermission.Demand();<br />
<br />
}<br />
The problem is, I haven't done anything to specifically grant my application this permission, and when I call Demand no SecurityException is thrown. But, I want a SecurityException to be thrown since I have not explicitly granted any code that permission.
Why does this happen?
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
You've hopefully already read this, but be sure you're familiar with the content described in Creating Your Own Code Access Permissions[^] in the .NET Framework SDK. Also be sure that your permission class is installed into the GAC and granted FullTrust permissions, as is documented (and for reasons that should be obvious).
If your application is granted FullTrust permissions, than it really doesn't matter what permissions you demand - they will all succeed.
Also, make sure that any callers higher in the stack haven't asserted that permissions (if they have it, they can grant it for children).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I overlooked the subtle fact that all code on the local computer gets Full Trust by default. That's all.
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
i can get the video stream but i can't transfrer the another computer in the Lan,or internet.
|
|
|
|
|
You have to setup a video server on your host machine. You can get the Windows Media Encoder to be the server or you can start here[^] if you wanted to reinvent the wheel and write one yourself.
RageInTheMachine9532
|
|
|
|
|
I am looking into this myself. I want to have a streaming server with multiple clients running on the same box as the server. Have you found any help or examples on this?
Regards,
Eric C. Tomlinson
I won't dignify your question with an answer. Yes, I program in VB6, but only because I'm addicted to eating!
|
|
|
|
|
I want to transfer images from client to server,till now i used TCPListener and TCPClient classes in C#.means i use simple socket programming,but i read some where that tapi uses H.323 protocol which is faster for transfering video/audio streams or any other streams. My question is that can H.323 protocol be used for transferring images from client to server.give me any sort of help
mughalali
|
|
|
|
|
See the post I submitted down on your other thread.
The TAPI 3.1 docs start here[^] on MSDN. You'll have to P/Invoke a BUNCH of functions and translate structures from C++ into C# in order to use them.
RageInTheMachine9532
|
|
|
|
|
How can i get the baseline of a font object?
eg: (imagine this is a lower case g :P)
<br />
----------------- (text top is about here (top of capital letters) <br />
<br />
<br />
********<br />
** **<br />
** **<br />
** **<br />
******* -------- (baseline is here) <br />
**<br />
**<br />
****** --------- (textbottom is here)<br />
is it even possible to get this from a gdi+ font?
i need it for my 100% managed gdi+ html renderer engine.
http://www.compona.com/xhtmlrender10.gif[^]
//Roger
|
|
|
|
|
look at Font.EmHeight in points, Font.GetAscent in points, Font.GetDescent in points, Font.Height in pixels
The best way to convert it, it to Font.GetHeight()*(Font.GetAscent/Font.EmHeight) given a top left as the 0,0.
top secret xacc-ide 0.0.1
|
|
|
|
|
I use MSComm control in a C# applications. Most time the program works well. But the only problem is that, at a certain position in the transporting sequence, the server terminal has returned reply, but the OnComm event doesn't execute immediattely. It will execute in several seconds. That seems the MSComm control doesn't work at the point for several seconds.
Anybody meet similar problem?
Can you help me?
vigorous
|
|
|
|
|
u must use the CEOL command which allocates the COM's with the Demands.
Ok
|
|
|
|
|
Anonymous:
What's meaning of CEOL command? I don't understand it, could you please explain it further?
Thanks
vigorous
|
|
|
|
|
I don't know to work very well with GDI+.
Can someone help me?
I draw some ellipse in the area of a panel,and I can move this rectangle even outside the panel and I loose the ellipse(I can't see it).
I want to limit the mouse movement in the area of a panel,how can i do this?
If someone can help me,please tell me how?
Thanks
|
|
|
|
|
override OnMouseMove in the panel
|
|
|
|
|
you'll need ClipCursor API to limit the cursor to a specific area (rectangle)
|
|
|
|
|
private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
<br />
Point mDL = new Point(e.X,e.Y);<br />
<br />
if (mDL.X>panel1.Width || mDL.Y<panel1.Height)<br />
{<br />
mDL.X=panel1.Location.X+panel1.Width-20;<br />
mDL.Y=panel1.Location.Y+panel1.Height-20;<br />
this.Cursor = new Cursor(Cursor.Current.Handle);<br />
Cursor.Position = new Point(Cursor.Position.X - 40, Cursor.Position.Y - 40);<br />
Cursor.Clip = new Rectangle(panel1.Location,panel1.Size);<br />
}<br />
panel1.Invalidate(); <br />
}
still i can move my ellipse outside the panel.And after I move the cursor outside the form I can move the cursor only in the upper part of the form?!?!
Can you give me another tips??
Thanks
|
|
|
|
|
Hello!
I have a service installed on some winxp machines and i want the service to send the CTRL+ALT+DEL keyboard event to the host operating system, followed by a username,TAB and a password, so that i could log on the user locally on the target machine.
I don't know how to do that, nor wether it is possible for a .NET service or application to take control over the keyboard at such a low level.
Though, i can launch a MFC exe who does that but i don't know how to create that code, because my knowledge about VC++ & MFC is poor.
If anyone knows a resource, an example, a place to start digging from, for either the MFC or .NET solution, please reply.
Thanks!
|
|
|
|
|
|
Thanks for the tip, but I wanted not to catch the keyboard events, but to generate them.
I will send through the network to the service on the remote machine a username and a password and it will create the CTRL+ALT+DEL event and then, one by one, the letters of the username and password strings, so that i can locally logon the user at that remote computer.
I don't know how to create those events, without using any windows.forms classes, wich normally treat such events.
|
|
|
|
|
Ctrl+Alt+Delete is not sent to the hook chain. It is handled ONLY by Windows (specially, most likely LSA).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
First, your service must be allowed to interact with the desktop service. It does this either by logging on as LocalSystem with the "Interact with Desktop" (or something like that) option, or as a specific user (although then it would only work for that user).
Then you need to get the desktop handle for the session (like P/Invoking GetDesktopWindow - which may return NULL is there are no active users) and you can P/Invoke SendInput . See http://pinvoke.net/print.aspx/user32.sendinput[^] for an example. You can use the Keys enumeration in .NET, since the enumeration member values are the same as the native VK enumeration constants.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does anybody have some code or have any idea on how to get the sys or cpu temperature?
/\ |_ E X E GG
|
|
|
|
|
|
So far the only means of doing this i have found is if your motherboard have monitor software that comes with it. THen you could call it's dll. However that's not an option for me.
What mb do you have?
/\ |_ E X E GG
|
|
|
|