Problem while Writing to Remote Location in a .netThread

hi

i am having problem when i am trying to write something on remote location using .net thread.
e.g. i have a central location letsay MachineName|MachineIP/SharedDrive.
and i am creating a thread on click of a button which i need to write some information on that location.

i have also added a node in web.config of my application.

and i have also given credential in --

but it is giving the following exception:
The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.

below is my method which i am calling on a separate thread.
private void WriteSomeThingToRemoteLocation ()

{
FileStream fileStream = null;
BinaryFormatter binaryFormatter = null;
System.Object systemObject = null;
System.Object obj = new object();
lock ( obj )
{
string _contractLocaterKey = Guid.NewGuid().ToString().Replace( "-", "" );

string fullPath = @\MyMachineIPSharedDrive + "\" + _contractLocaterKey + ".dat";
try
{
fileStream = new FileStream( fullPath, FileMode.CreateNew, FileAccess.Write );
binaryFormatter = new BinaryFormatter();

systemObject = new object();
systemObject = "Hello this is testing1";
binaryFormatter.Serialize( fileStream, systemObject );

systemObject = new object();
systemObject = "Hello this is testing2";
binaryFormatter.Serialize( fileStream, systemObject );
}
// catch(Exception ex)
// {
// avoided for getting noticed what happened;
// }
finally
{
if ( fileStream != null )
{
fileStream.Close();
fileStream = null;
}
binaryFormatter = null;
systemObject = null;
}
}
}

please help in this matter as i am stucking in the problem from more than 3 days.

this thing is happening OK :
1. if i call this method directly on another method.
2. if i call this method in a console application .
3. if i call this method on a thread in a console application.

any help would be highly appreciated.

thanks

vishal sharma

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories