|
Well, like I said, use process explorer to find out what process is locking the file. You can run process explorer on the server.
(If the user just created the image through your application, It's likely your not properly closing the file after creating it)
Simon
|
|
|
|
|
OK, then your app can't work at all. Because, if the file is created by the user, then it must be on the local file system, which your web app cannot access, it only works because you're testing it on the machine that is also the server. It also means you're in the wrong forum, we have an ASP.NET forum.
If you mean the user uploaded the image to the server, then it's your code that creates the file, and is at fault for keeping it locked.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Understand what you are doing before you try this. This code forcefully closes the handle to the file. If another app has held the file open, it has probably done so for a reason, forcefully closing it has a strong chance of causing problems/errors in the app. If it's your app that holds the lock on the file, forcefully closing the handle will be likely leave you with invalid/null objects. You should just close the file properly.
[EDIT]
I haven't tried it, and I'm no ASP.NET expert, but I suspect you'll have problems getting this code to run anyway, because you won't have the permissions to use P/Invoke in the server environment.
[/EDIT]
Simon
|
|
|
|
|
I understand it and I'm not encouraging him to do so. I just gave him an example. He decides whether he wants to use it or not.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Sorry, I didn't mean for you to understand it. I've read a few of your articles, I've no doubt at all that you know what your doing I just meant for Exelioindia to be careful with using that. Probably should have made that clearer.
Simon
|
|
|
|
|
It's ok
Simon Stevens wrote: I've read a few of your articles,
Hope you liked them
Giorgi Dalakishvili
#region signature
my articles
#endregion
modified on Tuesday, April 8, 2008 5:39 AM
|
|
|
|
|
Hello
I face a problem with datagridview when want to retrive the particular row index.
In my application I select more then one row by presssing control key. After that when I want to retrive the row index from selected rows then it return wrong row index.
So plz help me regarding this.
Debasmita
|
|
|
|
|
Could please be more descriptive.
Anyways this works fine for me:
int i = this.dataGridView1.SelectedRows[1].Index
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
checking how many rows are selected in the grid.
First column is check box column.
this code will help to learn something
int count =0;
foreach (DataGridViewRow row in dgrdviewBranch.Rows)
{
bool selectrow = Convert.ToBoolean(row.Cells[0].Value);
if (selectrow == true)
{
count += 1;
}
}
|
|
|
|
|
The command line prompt for running winzip. The below command zips "1.txt" file into "zippy.zip"
C:\Program Files\WinZip>winzip32.exe -min -a D:zippy.zip D:\\1.txt
I want to do this programatically using C# using Process.Start(). I have trouble specifing the parameters for winzip exe. If i give only the exe name as below winzip application opens
System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe");
When i try giving the parameters(file name etc) as below it gives an error at run time "The system cannot find the file specified"
System.Diagnostics.Process.Start("C:\\Program Files\\WinZip\\winzip32.exe -min -a D:zippy.zip D:\\1.txt");
I'm not sure if there is any problem with double quotes "". How can i specifiy the paramters? Please help
|
|
|
|
|
You specify the parameters as an argument, and I suspect you need to put the full path in quotes because it has a space in it. So, you're writing a program that will only ever run on your personal PC, no-one else will ever use it ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have specified the path in quotes but still not working. Can you please provide code snippet?
My requirement is that the files should be zipped using Winzip only so that user can unzip it. If i use System.IO.Compression.GZipStream then i cannot unzip the files. Again i need to have a program for decompression.
|
|
|
|
|
I found the solution. I was using Process.Start with 1 paramters instead of using 2 parameters (2nd paramenter for argument). Thanks for all your help
|
|
|
|
|
OK, I thought that might be it, too. Either way, I still think you're doing it the wrong way
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'd take a look at doing this in process if I were you. There are several free third party assemblies which will help you here. ICSharpCode.ZipLib does the job just dandy.
Regards,
Rob Philpott.
|
|
|
|
|
i am using C#.net 1.1 while using clipboard m geeting this exception
System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Clipboard.GetDataObject()
|
|
|
|
|
// [STAThreadAttribute]
[STAThread]
public static void Main()
put that attribute in your entry point.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i have made an entry [STAThread]
public static void Main()
still m getting the exception
|
|
|
|
|
OK - well, that's how you set it. Do you set the thread model to something else, elsewhere in your code ? I don't even know if you can, but that attribute is what it's telling you to set. Have you googled the error message text ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ya i have googled but itz saying to set entry point as what u said. but i cant figure out the exception
|
|
|
|
|
Are you trying to access your object from a background thread?
|
|
|
|
|
M trying to access Clipboard.GetDataObject();
it is throwing exception when accesing clipboard
|
|
|
|
|
hello
how can i save state of a controls in an xml file ??...later I need to load and generate in my form...anyway to do that..?? (those controls generated dynamically)
|
|
|
|
|
You need to write the code to save and reload your controls and their state, there's nothing built in that I know of
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|