We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : ASP.NET
|
Category : Miscellaneous

How to save the Output of ASP.NET to HTML

Use the namespaces
  • System.Net which have classes WebRequest and WebResponse.
    • WebRequest is the abstract base class for the .NET Framework’s request/response model for accessing data from the internet and
    • WebResponse is the abstract base class from which protocol specific response classes are derived.

  • System.IO which have classes StreamReader and StreamWriter.
    • StreamReader designed for character input in a particular encoding.
    • StreamWriter designed for character output in a particular encoding.
VB.NET C# Note:For creating the file (in above case "temp.html") give appropriate rights (modify and write) to the ASPNET user.
To specify the Encoding specify the second parameter of the StreamReader accordingly
VB.NET C#

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.