Created
June 1, 2011 04:43
-
-
Save JayDouglass/1001798 to your computer and use it in GitHub Desktop.
Output html from WCF REST service using stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Stream GetPage() | |
{ | |
var page = Properties.Resources.Status; // page from resources | |
// Get site relative base url for use in javascript ajax requests | |
var baseUrl = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.BaseUri.AbsolutePath; | |
page = page.Replace("%BaseURL%", baseUrl); | |
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(page)); | |
WebOperationContext.Current.OutgoingResponse.ContentType = "text/html"; | |
return stream; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment