..HtmlControls.HtmlInputFile.Saveas(filename) not overwriting

G

Guest

System.Web.UI.HtmlControls.HtmlInputFile.SaveAs(FileName) is not overwriting
the file. It used to work fine on IIS5.1 Recently we migrated to IIS6.0.
Since then it's not working. If it's new file it works fine.
For the same file getting the error
"Access to the path "" denied.
I gave fullcontorl to ASPNET user on the folder.

Please help me.
Thanks
reddy
 
N

Nathan Sokalski

When using the HtmlInputFile control, you must use
Web.UI.HtmlControls.HtmlInputFile.PostedFile.SaveAs(FileName) to save it,
the SaveAs method is NOT a method of the HtmlInputFile class. I have not
seen all of your code, but see if it works when you make this change. Good
Luck!
 
G

Guest

Yes, I am using that only. But not working. As i said. It works for file
first time. If you try to load same file it give access denied error, which
supposed to overwrite the old file.

Thanks
 
N

Nathan Sokalski

I am not sure if this is the problem, but try checking the ReadOnly property
of the file after you write it the first time. I am not sure what SaveAs
sets the properties to when it saves it. Even though it is not what you are
looking for, a one-line if statement testing for and deleting the file
before the SaveAs wouldn't be hard, such as in the following:

If IO.File.Exists(Server.MapPath("myfile.txt")) Then
IO.File.Delete(Server.MapPath("myfile.txt"))

It's only one line, and the code is very simple, so if my ReadOnly property
idea isn't the problem, I would just use that rather than frustrate yourself
trying to figure it out. You can always work on it in your free time (and
maybe if you're lucky some will respond in the future with a solution,
sometimes it takes a while to get responses that actually fix the problem).
Good Luck!
 
G

Guest

ReadOnly Property is not problem. So i am following the other idea. I too
hope somebody will give the anwer.
Thanks
reddy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top