473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Exception has been thrown by the target of an invocation....what is this?

I've written a function that will upload a file. This sort of works. It
works sometimes, and then other times...namely when it tries to write to an
existing directory (but not always), I get this error:

Exception has been thrown by the target of an invocation.

Googling seems to indicate that that's a pretty generic error. Is there any
way to find out more specifics as to what is causing this?

The specific line it appears to choke on is this:

postedFile.SaveAs(savePath & strUploadFileName)

Again, it works sometimes, not others. Both times, it has the same string.
I'm stumped.

-Darrel
Nov 19 '05 #1
2 10204
darrel wrote:
I've written a function that will upload a file. This sort of works. It
works sometimes, and then other times...namely when it tries to write to an
existing directory (but not always), I get this error:

Exception has been thrown by the target of an invocation.

Googling seems to indicate that that's a pretty generic error. Is there any
way to find out more specifics as to what is causing this?

The specific line it appears to choke on is this:

postedFile.SaveAs(savePath & strUploadFileName)

Again, it works sometimes, not others. Both times, it has the same string.
I'm stumped.

-Darrel


Is it when the file already exists? Perhaps it won't automatically
overwrite the file on the filesystem.....or make sure you the aspnet
account has Delete/Modify access in Windows to the target folder, as
creating a file is different permission than deleting/modifying. dunno...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2
> Is it when the file already exists? Perhaps it won't automatically
overwrite the file on the filesystem.....or make sure you the aspnet
account has Delete/Modify access in Windows to the target folder, as
creating a file is different permission than deleting/modifying. dunno...


It's something like that. If the folder/directory exists it pukes with that
error. I'm guessing it is a permissions issue, but everything seems OK.

-Darrel
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
3
by: Minh | last post by:
I create a C# Project using Windows Application template, I add an imagelist to Form, and add icon to imagelist1. After that, I run Project, but an Exception has occured. I can fix it even...
4
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP...
0
by: Val | last post by:
From: "Val Mazur" <group51a@hotmail.com> Subject: Exception has been thrown by the target of an invocation Date: Monday, June 06, 2005 2:01 PM Hi guys, For some reason when application tries...
0
by: Kivak Wolf | last post by:
Yet another problem, I'm finding a few problems... This is yet another one. All i am trying to do is create 2 sql data source objects and connect them to the same data table with the same...
2
by: Eugene | last post by:
Hi, I have a problem when loading one of my dll. I have a main class that would load a winform in another dll using reflection. When I load it using Assembly.CreateInstance(DLLName.DLLFormName), an...
2
by: Monty | last post by:
I have a GridView in an update panel, and the GridView has an ObjectDataSource. Under certain conditions the Object that is the ObjectDataSource will throw an exception with a specific error...
2
by: Academia | last post by:
I find the following warning in my Error List: Warning 1 Exception has been thrown by the target of an invocation. 0 0 This is a solution with 41 projects and I have no idea which one is...
1
by: Curious | last post by:
Hi, I get the error, "Exception has been thrown by the target of an invocation", at the last line of code. Any idea why this happens and how to get it fixed? Type mySFunction =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.