web 2.0

ASP.NET(vb.net) Response.ContentType() - Response Object

ASP.NET(vb.net) Response.ContentType() - Response Object - Response.ContentType() : The ContentType property specifies the HTTP content type for the response. If no ContentType is specified, the default is text/HTML.

ShotDev Focus:
- ASP.NET(vb.net) Response.ContentType() - Response Object

Example

AspNetResponseContentType.aspx

<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Response.Clear()
Response.AddHeader("Content-Disposition", "Attachment;Filename=Excel.xls")
Response.Buffer = True
Response.Charset = "UTF-8"
Response.ContentType = "application/vnd.ms-excel"

Response.write("<table width=500  border=1>")
Response.write("  <tr>")
Response.write("    <td>Column1</td>")
Response.write("    <td>Column2</td>")
Response.write("    <td>Column3</td>")
Response.write("  </tr>")
Response.write("  <tr>")
Response.write("    <td>1</td>")
Response.write("    <td>2</td>")
Response.write("    <td>3</td>")
Response.write("  </tr>")
Response.write("  <tr>")
Response.write("    <td>4</td>")
Response.write("    <td>5</td>")
Response.write("    <td>6</td>")
Response.write("  </tr>")
Response.write("</table>")
End Sub
</script>

Screenshot

ASP.NET(vb.net) Response.ContentType() - Response Object

ASP.NET(vb.net) Response.ContentType() - Response Object
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

One Response to “ASP.NET(vb.net) Response.ContentType() - Response Object”

  1. 2diagnostic…

Leave a Reply

You must be logged in to post a comment.