TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bhavesh Vankar
755
1.2k
89.2k
Capture image Again if image not currect
Aug 28 2020 7:23 AM
i want to capture image again if image not proper in c# using webcam into web application. but below error is generate while recapture image. how to solve this error.
Additional information: The process cannot access the file 'C:\VisiterManagment\VisiterManagment\CapturedImage\Image.jpg' because it is being used by another process.
i am also deleting existing file using file exist but not working kindly please help me.
here is my c# code
string
FileName = Path.GetFileName(
"~/CapturedImage/Image.jpg"
);
if
(File.Exists(Path.GetFileName(FileName)))
{
File.Delete(FileName);
}
if
(!
this
.IsPostBack)
{
if
(Request.InputStream.Length > 0)
{
using
(StreamReader myreader =
new
StreamReader(Request.InputStream))
{
string
myhexString = Server.UrlEncode(myreader.ReadToEnd());
//string myimagePath = string.Format("~/CapturedImage/" + DateTime.Now.ToString("dd-MM-yy hh-mm-ss") + ".jpg");
string
myimagePath =
string
.Format(
"~/CapturedImage/Image.jpg"
);
File.WriteAllBytes(Server.MapPath(myimagePath), ConvertHexToBytes(myhexString));
Session[
"CapturedImage"
] = ResolveUrl(myimagePath);
}
}
}
Reply
Answers (
2
)
How to detect Bluetooth dongal has inserted in PC or not?
List to export to excel with multiple sheets using EPPLUS C#