|
Hey, I keep getting the UnauthorisedAccessException from the following code - the user account I'm using to connect to the server in question does have permission to read/edit the registry. I have also modified the my routing table so I can access the server resources by name. If anyone could help me out I'd greatly appreciate it.
using System;<br />
using System.Security;<br />
using System.Security.Permissions;<br />
using Microsoft.Win32;<br />
<br />
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, Read = @"HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx")]<br />
[assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, UnmanagedCode = true)]<br />
<br />
String KEY = "SOFTWARE\\Network Associates\\TVD\\Shared Components\\VirusScan Engine\\4.0.xx";<br />
<br />
try<br />
{<br />
RegistryHive hKey = RegistryHive.LocalMachine;<br />
<br />
RegistryKey DATKey = RegistryKey.OpenRemoteBaseKey(hKey, _ServerName).OpenSubKey(KEY);<br />
}<br />
...
It seems to get past the RegistryHive.LocalMachine part, but throws the exception when it gets to the open remote base key call. I tried separating the OpenRemoteBaseKey() and OpenSubKey() calls into 2 separate lines, to see if it was maybe OpenSubKey() that was throwing it, but the same exception was thrown on the OpenRemoteBaseKey() call.
Thanks.
|
|
|
|
|
b_girl wrote: UnauthorisedAccessException
It means you have to be authenticated and have permissions on the server.
|
|
|
|
|
I am authenticating with the server and the account I'm authenticating with has permission to read/edit the registry. I'm doing the authentication when I connect - I'm using the Ras API to establish a VPN connection to the server.
Do I have to authenticate again after the connection is established?
|
|
|
|
|
I have a C# .Net application which generates a XML file on the web server when the user clicks on a button. After that file is produced, I need to be able to push that xml file to the client machine (preferably with an open dialog box so the user can choose the destination). I am thinking this can be done with Response.Write, but I have not been successful. Thanks.
|
|
|
|
|
You could use the WebClient class
Try this:
string URL = "http://www.somesite.com/filename.fileExtention";
string localLoc = "C:\\filename.fileExtention";
System.Net.WebClient c = new System.Net.WebClient();
c.DownloadFile(URL,localLoc);
You could use a browse dialog for the location to save the directory.
Hope that helps,
K
-K
|
|
|
|
|
On second thoughts, I do not think this would work as you are writing from server to client. That's something I didn't register the 1st time around. oops. Sorry.
-K
|
|
|
|
|
|
On every DirectX sample I see the whole form and every aspect of drawing the controls/graphics on the form is handled exclusively by DirectX, ie overiding OnPaint().
My question is, is it possible to have just part of your application directX? e.g., I want to design a normal form w/ visual studio, and then add a little box on my form that will display some directx content. (Specifically, I just want to load 3d model and rotate it.)
Is this even possible? Maybe a directx control I can place on my form. I don't have any directx experience, can somebody please guide me?
/\ |_ E X E GG
|
|
|
|
|
Inherit from a control and override the controls onpaint event for your direct X. I did this for the star wars credits I placed in a system once. It works well.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Do you have any examples?
/\ |_ E X E GG
|
|
|
|
|
Due to the signing of a non-compete no. However, if you understand direct X then it is a trivial task. If you do not understand direct X then you are asking the wrong questions. First I would research writing your own custom control, it will cover the on paint override, then just pass the control's handle to direct X
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I haven't tried it, but you might take a look at this article
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks, that's just what I was looking for.
Actually now, I'm using a picturebox and direct 3d!
/\ |_ E X E GG
|
|
|
|
|
excuse me
first thanks for help
i want to set the DataBindings property for datagrid by dataview
but it send me an exception here is the code i wrote
DataView custadd=new DataView(customer.Tables["address"],"","",DataViewRowState.CurrentRows );
custadd.AllowEdit=true;
custadd.AllowNew=true;
custadd.AllowDelete=true;
custadd.Table =customer.Tables["address"];
custadd.RowFilter="cust_ID='"+txid.Text+"'";
dataGrid1.DataBindings.Add("DataSource",custadd, );
the databindings takes three arguments but i do not know the 3 argument
thanks
MD_NADA
MD_NADA
|
|
|
|
|
can some1 recomend me of a good tcp\ip socket server code\snifft ? (if it can get multiple connections it will be better)
|
|
|
|
|
I liked this example a lot. It's an asynchronous TCP Server/Client.
http://codeguru.earthweb.net/csharp/csharp/cs_misc/sampleprograms/article.php/c7695/
http://codeguru.earthweb.net/csharp/csharp/cs_network/sockets/article.php/c8781/
Good Luck
-K
|
|
|
|
|
Does anyone know how to overcome the DBNull.Value problem with databinding to a detached row?
When you bind to a detached row and any of the columns have a null value (DBNull.Value), an exception get's raised. It is impossible to use the DataBindings[idx].Format or DataBindings[idx].Parse to 'catch' the null value and change it, because you have to set the databinding before you can set the .Format and .Parse handlers, and the error gets thrown when you set the databinding.
... and no, I don't want to bind to a DataTable. I need to bind to a detached row.
Paul Brower
|
|
|
|
|
I'm assuming by 'detached row' you mean a DataRow that is not in a DataTable. Is that correct?
Why do you need to bind to a detached row? Why not just bind to a DataView which filters in only that row? What about binding to the ItemArray of the row instead?
|
|
|
|
|
Yes, 'detached' is not in the DataTable.
Binding to the itemarray would cause the same problems with the bindings.
Although I don't particularly like the solution, I have come up with one that works. Apparently the ability to have DBNull.Value passed to a databinding, and function properly, is tied to the DataSet level. If you have a detached row, going back up to the DataSet (row.DataTable.DataSet) will be null.
So, what I had to do, is create an Empty strongly typed dataset, and generate a new row from a table from this new dataset. I can then bind directly to the row (which is now NOT detached, but it is 'detached' from my main strongly typed dataset) and not have a problem with null column values.
|
|
|
|
|
Paul Brower wrote: So, what I had to do, is create an Empty strongly typed dataset, and generate a new row from a table from this new dataset. I can then bind directly to the row (which is now NOT detached, but it is 'detached' from my main strongly typed dataset) and not have a problem with null column values.
Phew! Talk about building a street so that you can cross it!
|
|
|
|
|
This may be a simple question, but I am writing a program that utilizes a pictureBox to show the currently selected picture. Below the pictureBox is a "Browse..." button that calls an openFileDialog. My question is, how to i get the picture selected to appear in the pictureBox. Or i guess a better question would be how to extract the path of the selected file from the openFileDialog so i can use it as I please.
Thanks in advance for any help.
|
|
|
|
|
If you select a file in openFileDialog, you get the whole path and filename also. That means you can use :
this.pictureBox.Image = Image.FromFile(this.openFileDialog.Filename);
|
|
|
|
|
Hey there,
Is there any way to (programatically) find out the hard disk size of a computer without using WMI?
My best idea is to recurse through all the directories (externally calling dir/p) and find out how much space is taken by each directory and then adding it to the free space.
But that is quite cumbersome.
Any ideas?
-K
|
|
|
|
|
|
Actually, I like WMI a lot.
However, the application is required on an embedded system running Win XP Embedded that doesn't have WMI as a component.
-K
|
|
|
|