2011-02-16 66 views
0

你好,我做了一個網站誰返回一個序列化的對象。然後我從一個獲取對象並反序列化的Fatclient開始請求。 當我在本地主機開始我的頁面時,我可以輕鬆獲取序列化對象並將其反序列化。但是,如果我將它發佈到服務器,我無法取回我的對象​​,我只是回到一個html頁面,他說我必須接受cookie。 我正在尋找約6個小時的幫助。C#餅乾錯誤迴應

我的連載:

  Response.ContentType = "application/octet-stream"; 


     var binaryFormatter = new BinaryFormatter(); 
     binaryFormatter.Serialize(Response.OutputStream, ud); 

     Response.End(); 

Deserialisation:

WebClient wb = new WebClient(); 



     String test = wb.DownloadString(url); 

     byte[] b = wb.DownloadData(url); 

     var mystream = new MemoryStream(b); 

     BinaryFormatter binaryRead = new BinaryFormatter(); 


     Userdata userdata = (Userdata)binaryRead.Deserialize(mystream);; 
     mystream.Close(); 

HTML錯誤頁面內容:

Cookie錯誤 您的瀏覽器不接受cookies。請在您的瀏覽器設置中啓用Cookie,然後再次嘗試訪問該應用程序。

+0

你有沒有考慮Web服務的一種特殊的成分嗎? – 2011-02-16 10:26:26

回答

0

,因爲我們在公司用它來識別用戶其不能使用web服務對這一任命