|
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
File.Copy(@"C:\Demo2.zip", @"C:\NewDemo2.zip");<br />
}
Seems to work fine with me....
|
|
|
|
|
Here's a tip: Learn how to debug. It will be far more efficient than posting a question in a forum every time something like this happens.
led mike
|
|
|
|
|
Hi All,
I thought it would be simple solution but not really being able to crack it.
I have a webservice which acts as data provider to the client which is a windows application. The webservice has various web methods and I have written them in a way that they share same SQLTransaction object while retrieving data.
WebService has BeginTransaction(), CommitTransaction() and RollbackTransaction() methods. when I want to perform an operation (which typically consists of 3/4 webmethod calls) I call BeginTransaction() first and CommitTransaction() or RollbackTransaction() after the operation is finished or in case of exception.
The problem:
If the user makes the application to end using task manager after BeginTransaction() has been called and before CommitTransaction() or RollbackTransaction() is called. When next time the application is launched, it fails to fetch data and gets stuck attempting to retieve it. This is because the previous transaction is still locking the tables!
Well, It might take long to read the post but I thought it was important to explain it in detail.
Can anyone think of any way out?
Thanks in Advance
AD
Every bit counts
|
|
|
|
|
The odds of that happening are EXTREMELY Slim...
It's like the "If x is saving, and I have a Power Failure, then it crashes next time it starts up."
type of question.
Although, maybe in your case you could have a true / false setting which decides if the transaction is in process, with a timeout. If it expires, it automatically rolls back.
Just an idea
- Reelix
|
|
|
|
|
Thanks for reply.
The problem is I dont have anything to check even if I use true/false. The application has been closed and it doesnt even know that it is being closed down. I dont get any event when the application is closed using task manager.
AD
Every bit counts
|
|
|
|
|
Hi!
I am making an asp.net c# application (dotnet framework 3.5), where I am trying to update RegistryKeys on computers in the local area network at my company.
When executing OpenRemoteBaseKey() on one of the computers (running Vista), this:
RegistryKey regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
MachineName);
results in an IOException: "The network path was not found.\r\n"
When I try executing OpenRemoteBaseKey() on another (running win 2000), the OpenRemoteBaseKey operation works fine, but then the
CreateSubKey() fails in an UnauthorizedAccessException "Access to the registry key 'HKEY_LOCAL_MACHINE\\SYSTEM\\..' is denied."
I can run both on my local computer with no problem, so the application obviously lack rights(?) in performing the operations, hence my question is how do I set the access rights in order to be able to update these keys on all computers in the network, meaning running this with no problem:
RegistryKey regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, MachineName);
RegistryKey newKey = regKey.CreateSubKey(RegistryPath);
newKey.SetValue("mycomment", myText);
?
Regards,
Heidi H.
heidihundala@gmail.com
|
|
|
|
|
heidihund wrote: The network path was not found.
Are you sure that the machine name is correct? If it is, does the client allow remote registry access? If it's saying it can't find the network path my suspicion is the path is incorrect, or a firewall is blocking it.
|
|
|
|
|
Yes. The name is correct.
I don't think the firewall is blocking it, but the security is probably the issue, hence
I wonder if there is another way of changing the registry value remotely, where e.g. it is possible to set the username and password when accessing the registry, in order to have the security settings in order? I have gotten some hits on WMI, but I haven't found a way to do this in csharp yet.
Regards,
Heidi
heidihundala@gmail.com
|
|
|
|
|
The only way I can think of is to log on before hand because I just wrote a simple piece of code to access the registry on my Windows 2003 server which is running under the default tied down settings. It worked fine and my laptop and server on different domains but I am logged onto the server to access files and my account which I'm logged in under is a Domain Administrator group so...
|
|
|
|
|
I found a solution which is with not using OpenRemoteBaseKey(), and where you "log on" in a Connection before the change:
System.Management.ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = "username";
oConn.Password = "pwd";
oConn.EnablePrivileges = true;
ManagementScope oMs = new ManagementScope(string.Format("\\\\{0}\\root\\default", MachineName), oConn);
oMs.Connect();
if (oMs.IsConnected) {
ManagementPath Path = new System.Management.ManagementPath("StdRegProv");
ManagementClass objClass = new System.Management.ManagementClass(oMs, Path, null);
ManagementBaseObject objInParams = objClass.GetMethodParameters("GetStringValue");
objInParams["hDefkey"] = LOCAL_MACHINE;
objInParams["sSubkeyName"] = KEY_NAME;
objInParams["sValueName"] = "NameOfRegKey";
ManagementBaseObject outParams = objClass.InvokeMethod("GetStringValue", objInParams, null);
objInParams = objClass.GetMethodParameters("SetStringValue");
objInParams["hDefkey"] = LOCAL_MACHINE;
objInParams["sSubkeyName"] = KEY_NAME;
objInParams["sValueName"] = "NameOfRegKey";
objInParams["sValue"] = "My value";
objClass.InvokeMethod("SetStringValue", objInParams, null);
}
Regards,
Heidi
heidihundala@gmail.com
|
|
|
|
|
Also, the code is running as the ASPNET user on the server, which doesn't have any permissions to any other machine. So, the most it's going to be able to do is look at the values under a remote HKEY_LOCAL_MACHINE hive. It won't be able to modify anything.
Unless, of course, you run the ASP.NET app on the server under a domain admin level user account, but that's a huge security risk...
|
|
|
|
|
I am developing a game the contains ball and blocks and i want the ball to break the blocks upon collision with the ball and also to award marks after every collision
The background color should fill the space of the ball
|
|
|
|
|
M'kay
betonglasermur.FeedDwarf(pur_is, 17);
ProcessStartupInfo.AintNotCreateNoWindow = (false && !true) != (true || false) ? false == true ? true : false : (true != false && false);
Morgonen är tröttmans mecka
|
|
|
|
|
Sounds like you've got the start of a design going there. Now what are you going to do?
|
|
|
|
|
Permission granted. You can proceed with coding your game.
...or was there a question buried in your post somewhere?
|
|
|
|
|
Hi,
I have a Windows Application which should send data to a Webservice.
I've added the URL of the Webservice (Add Web Reference...) to my project.
I've also added the .cs file of the Webservice in my project.
This is from the Webservice:
POST /webservices/MTomTest/Mtomdummy.asmx HTTP/1.1
Host: secret.nl
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<AddFile xmlns="http://www.secret.nl/MTOMTest/v1">
<request>
<EmailAddress>string</EmailAddress>
<Filename>string</Filename>
<FileData>base64Binary</FileData>
</request>
</AddFile>
</soap12:Body>
</soap12:Envelope>
Based on what he needs (EmailAddress, Filename, FileData) I wrote the following:
string EmailAddress;
string Filename;
string FileDataBase64Binary;
SoapBase64Binary base64Binary;
MTOMDummy AddFileService;
EmailAddress = "email@secret.nl";
Filename = "TestDeclaratie.zip";
FileDataBase64Binary = "AgMFBws=";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
AddFileService = new MTOMDummy();
AddFileRequestType request = new AddFileRequestType();
The webmethod is called "AddFile" which I can call by using:
AddFileService.AddFile();
I only need to know what should give as parameters for the "AddFile" webmethod?
Any help would be greatly appriciated.
Regards,
Ronald
|
|
|
|
|
If I understtod your question correctly, you are unable to figure out the object to be passed to the AddFile() method.
You have to pass object of AddFileRequestType.
<br />
MTOMDummy AddFileService;<br />
<br />
AddFileService = new MTOMDummy();<br />
AddFileRequestType request = new AddFileRequestType();<br />
request.EmailAddress = "email@secret.nl";<br />
requestFilename = "TestDeclaratie.zip";<br />
request.FileData = <your file="" data="" in="" soapbase64binary="" format="">;<br />
AddFileService.AddFile(request);<br />
</your>
Every bit counts
|
|
|
|
|
Yes...I suppose you understand me. I did figure the following out:
string EmailAddress;
string Filename;
string FileDataBase64Binary;
SoapBase64Binary base64Binary;
MTOMDummy AddFileService;
EmailAddress = "email@secret.nl";
Filename = "declaratie1.zip";
FileDataBase64Binary = "AgMFBws=";
base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
AddFileService = new MTOMDummy();
AddFileRequestType request = new AddFileRequestType();
request.EmailAddress = EmailAddress;
request.Filename = Filename;
request.FileData = base64Binary;
AddFileService.AddFile(request);
Now is the object "request" filled with the email address, filename but not the filedata.
The code above gives me the following error:
Cannot implicitly convert type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary' to 'byte[]'
Any idea how to fill the "request.FileData" in the correct way?
|
|
|
|
|
Hello everyone,
Two questions about exceptions from ReaderWriterLock class,
1. If I use parameter -1 (no timeout value) to acquire either read or write lock, is there any possibility there will be any exceptions?
2. When we release the lock, if the current thread is the owner, is there any possibility to throw any exceptions?
thanks in advance,
George
|
|
|
|
|
ok.. so i'm adding some settings to a project and i want to modify a certain node and save it so that next time when i start the application, i have the new modified properties.
Settings set = Settings.Default;
set.SalutSetting = "New Value";
set.Save();
But the setting is restored to it's original value. What's wrong?!
I have Vista.. cand this cause any problems?
|
|
|
|
|
Is this when you're running debugging etc? You might want to call Settings.Default.Upgrade() or what ever it's called because if you've got a new version (with respect to the Version attribute of the assembly) then it won't load the old settings, you've explicitly got to call Upgrade() to copy settings from the old version to the new version.
|
|
|
|
|
I need to load/save some settings from another assembly so I changed the code to:
Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSectionGroup section = configManager.SectionGroups["userSettings"];
if (section != null)
{
ClientSettingsSection clientSettings = section.Sections["OutlookSync.Properties.Settings"] as ClientSettingsSection;
SettingElement element = clientSettings.Settings.Get("SalutSetting");
clientSettings.Settings.Remove(element);
element.Value.ValueXml.InnerText = "update";
clientSettings.Settings.Add(element);
configManager.Save();
}
Everything is nice and smooth when i run this code on a test project - applications are modified and next time i start the application, the updated config is taken, but when i include it in my application, the changes are not saved next time when the application starts. I searched everywhere in the application in order to find our if the configurations are override but it seems they are not. I'm complete shocked and without any ideas.
|
|
|
|
|
Sorry, I can only suggest some methods to find out some more:
Have you checked the file before and after the call to configManager.Save(); Just to see if they're being written and then overwritten. Or try making the settings file read-only and see if you get an exception when trying to save. If it does then at least you can confirm it's trying to write stuff to the file.
|
|
|
|
|
hi
I use crystall report for reporting but its too slow.How can i made it fast?
|
|
|
|
|
Hi all,
Please let me know about any class avail in .NET 2.0 to transmit single file with Credentials(username and password) on to server.
I have tried with HttpWebRequest class, but getting some problem. Do .NET have any classes to transmit file on Server.
Thanks,
Regards
Chintan
HCL Technologies...India
(Carefully) listen->(Deeply)Think->(Clearly)Understand->(Patiently) reply...
|
|
|
|