Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Problem while saving a file to Diffrenet server or Machine using windows service?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
R
14y
4k
1
Reply
Hi
I implemeted a windows service.It was installed on a "
Machine A
" .
The job of this service is read a file from a specified folder in "
Machine A
"
and move it to
"Machine B"'s
Shared folder.
"
Machine B
"'S Shared folder having full rights for a "
User A
". and i am imporsinating with
"User A"
to move file from "
MACHINE A
" to "
MACHINE B
".
It's throwing
"Access Denied Error"
Please let me know what went wrong with this?
private void MoveFile(FileInfo file)
{
try
{
if (objImp.impersonateValidUser())//immporsinate with user A
file.MoveTo("
\\\\Machine
B\\Shared Folder\\" + file.Name);
}
catch (Exception ex)
{
//Saev error message
}
finally
{
objImp.undoImpersonation();
}
}
Thanks
Rakesh
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Using the WebMethod property EnableSession to save data
HttpWebResponse by WebService