How can I create an http response from scratch?

Posted by ispiro on Stack Overflow See other posts from Stack Overflow or by ispiro
Published on 2012-06-24T20:08:36Z Indexed on 2012/06/24 21:16 UTC
Read the original article Hit count: 177

I have code that returns an http response, but it also includes the content of the page. How can I create a response from scratch so it won't include anything except what I put in it?

My code now:

GCheckout.AutoGen.NotificationAcknowledgment response = new GCheckout.AutoGen.NotificationAcknowledgment();
response.serialnumber = serialNumber;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.BinaryWrite(GCheckout.Util.EncodeHelper.Serialize(response));
HttpContext.Current.Response.StatusCode = 200;

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about html