I'm uploading an asp page to Share point/O365, the way I'm doing this is via a file stream with the page stored in the solution as a resource. Now what I have to do is replace a certain selection of text with the url of the host web, that in itself is fine and works as expected. The issue I'm having is converting this back into a "stream" type. My method needs to return a "stream" type variable, but I don't know how to convert my string back to a stream type (or load it into a stream object?)
See my code below for the conversion/replacement:
public static Stream replaceText (string webUrl, FileStream stream)
{
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
string content = reader.ReadToEnd();
content = content.Replace("hostWebUrl/", webUrl);
Stream streamResult;
// do some stuff here to convert back to stream type
return streamResult;
}