CipherIS
asked on
ASP.NET C# - Convert User input to HTML
I am converting a client/server app to a web app. In the client/server app the developer used a web browser to capture user input. The purpose was to store the input in the database in HTML format which would be used to send an e-mail at some point.
I cannot use controls, unfortunately. Anyone have any idea how I can duplicate a similar function after the user enters data in a textbox?
Would htmlencode work?
I cannot use controls, unfortunately. Anyone have any idea how I can duplicate a similar function after the user enters data in a textbox?
Would htmlencode work?
you create html template and simply replace the user input in the correct fields of the html.
ASKER
Huh?
forget the template, if u use web application u can save the current web page with the user input as HTML file:
WebClient myClient = new WebClient();
string currentPageUrl = Request.Url.ToString();
UTF8Encoding utf8 = new UTF8Encoding();
byte[] requestHTML = myClient.DownloadData(currentPageUrl);
string myPageHTML = utf8.GetString(requestHTML);
using (StreamWriter sw = new StreamWriter(Server.MapPath("~/user-input.html"), true))
{
sw.WriteLine(myPageHTML); // Write the html file.
}
ASKER
I need to just convert what is in the text box to HTML.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.