C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-24-2009, 02:26 PM   #1
Registered User
 
Join Date: Mar 2009
Posts: 1
[Remoting] HttpWebRequest/Response isn't remotable?

Hi i wrote in c# simple app to get HTML code by httpwebreqest/response. Main definition of this method is implemented in serwer exe file. So when I using it by calling this method from client then server application gets from internet this html code. But I want to force client to get this html code from WWW. I tried to make it Marshal by value but simple Serialization doesn't working. How to do that the object who gets this html code is activated from server but is used local by client. You can download my project file with all files. I hope it will be easy to undersnad my problem

RapidShare: Easy Filehosting

thanks a lot

Code:
remotable object class libary(interface):
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace Interfejs
{
    public interface IPobierz
    {
        string KodHTML(string URL);
    }
}

definitions for this interface(in serwer)
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using Interfejs;

namespace Serwer
{
    class Definicje : MarshalByRefObject, IPobierz
    {
        public string KodHTML(string URL)
        {
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(URL);
            HttpWebResponse res = req.GetResponse() as HttpWebResponse;
            Stream data = res.GetResponseStream();
            StreamReader sr = new StreamReader(data);
            string html = sr.ReadToEnd();
            return html; 
        }
    }
}
arcozz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remotable types conor20_ie C# Programming 0 06-18-2008 09:33 AM


All times are GMT -6. The time now is 05:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22