I am writing a c# program for HttpRequest and Response as below.
public string Methods(int id) { HttpWebRequest Request = (HttpWebRequest) WebRequest.Create(@"http://172.17.18.16:8082/item/detail/90"); Request.Method = "Get"; WebResponse Response = Request.GetResponse(); IHttpRequest request = (IHttpRequest)Request; IHttpResponse response = (IHttpResponse)Response; SetupRequest(request, response, session); //Request.Method = Method.Get; string m = request.Method; TemplateManager mg=new TemplateManager(); ItemController it = new ItemController(mg); it.Detail(); return m; } Here IHttpRequest and IHttpResponse are the Interfaces which are already created. I want to assign HttpWebRequest Request to the interface so that the remaining functionality should happen itself. I am getting error in casting lines as
Unable to cast object of type 'System.Net.HttpWebRequest' to type 'HttpServer.IHttpRequest'.
Please help me to find a solution
Thanks
IHttpRequestandIHttpResponseare already created ?