CODE LIBRARY: Straight Up HTTP String Response in VB.NET

Lots of C# code out there but need to return a basic string response in Visual Basic .NET?

Try this..

Dim response As HttpResponseMessage = Request.CreateResponse(HttpStatusCode.OK, “value”)
response.Content = New StringContent(THESTRINGVALUE, Encoding.Unicode)
response.Headers.CacheControl = New CacheControlHeaderValue()
response.Headers.CacheControl.MaxAge = TimeSpan.FromMinutes(1)
Return response 

Leave a Reply

%d