Sunny
7/7/2004 5:50:00 PM
Hi,
set up typeFilterLevel = "Full" both at client and server.
Sunny
In article <ehOsRqAZEHA.3228@TK2MSFTNGP12.phx.gbl>, kintsoon@hotmail.com
says...
> A serialize remoting object, when I try to upload a file to server by it,
> occur error:cause security limit, cannot access type
> System.Runtime.Remoting.ObjRef??
>
> thanks.
>
>
>
> attachment??source code & a part of error exception info.??
>
>
> Source Code:
>
> [Serializable]
> public class CFile: MarshalByRefObject
> {
> /// <summary>
> /// <p>upload a file to server</p>
> /// </summary>
>
> public bool SaveFile(string RemoteFileName,FileStream stream, Encoding
> encoding)
> {
> try
> {
> string strPath = Path.GetDirectoryName(RemoteFileName);
> if ((strPath != "") && (!Directory.Exists(strPath)))
> {
> Directory.CreateDirectory(strPath);
> }
>
> int BLOCK_SIZE = 4096;
> BinaryReader sr = new BinaryReader(stream, encoding);
>
> FileStream fs = new FileStream(RemoteFileName, FileMode.Create,
> FileAccess.Write);
> BinaryWriter sw = new BinaryWriter(fs, encoding);
>
> Byte[] buffer = new Byte[BLOCK_SIZE];
> int bytes = 0;
> int totalBytes = 0;
>
> while(totalBytes < stream.Length)
> {
> bytes = (int)sr.Read(buffer, 0, BLOCK_SIZE);
> totalBytes = totalBytes + bytes;
> sw.Write(buffer, 0, bytes);
> }
>
> sw.Close();
> sr.Close();
> fs.Close();
>
> return true;
> }
> catch(Exception e)
> {
> throw e;
> }
> }
> }
>
>
>
> a part of error exception info??
>
> {System.Runtime.Serialization.SerializationException}
> [System.Runtime.Serialization.SerializationException]:
> {System.Runtime.Serialization.SerializationException}
> HelpLink: Nothing
> InnerException: {System.Security.SecurityException}
> Message: "????°??«?????¬??·?·??????? System.Runtime.Remoting.ObjRef??"
> Source: "mscorlib"
> StackTrace: "
>
>
>