We help IT Professionals succeed at work.

C# Image Problem

118 Views
Last Modified: 2017-04-15
when I save a record with Image, it will save perfectly but when I updated the record again for Image it will say System.IO.IOException: "The file exists" on windows 7 64 bit . The installation directory is with read only attribute , I tried the best to remove this attribute but could not make it.
Can u help me out
Comment
Watch Question

Author

Commented:
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
I am doing in same way.. but in some cases this error occurs ....I have also attached the screenshot
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Well, the program files folder is definitely not the place to store user files, so try playing by the rules and use %localapppath%.

/gustav

Author

Commented:
Can u explain it with detail.. did not get your point exactly..?
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Try to save your files in a sub folder of the %localappdata%.

The Program Files folder is not intended for this purpose.

/gustav

Author

Commented:
There must be solution.. I think , if we install on client machine it would be installed on program file directory..
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
No. Normal user rights doesn't grant right to save anything in the Program Files folder. You need Admin rights, and a normal user should never be required to run your application with admin rights.

It's up to you to control the installation.

Author

Commented:
k.. then how to give the rights to normal user ....like admin rights. In that case it wont be a prob.
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You can set your application to require admin rights. That will pop the usual warning message and ask the user for credentials for an admin account.
But to save some pictures, this is bad practice and should be avoided. Again, use %localappdata% for storing user documents and files.

/gustav
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Question was answered.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions