Reputation: 7825
I have a C# project in Visual Studio that produces an aspx page. The code I am editing is in default.asp.cs
. When I build the project a file default.aspx
is produced. This file looks something like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CSRValidationConnector._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
When I make my web request most of this page comes back.
But I want the page to return only plain text and not any of this HTML. How do I configure things so that nothing is returned except what I add via Response.Write
calls in default.aspx.cs
?
Upvotes: 2
Views: 4419
Reputation: 19862
Response.ContentType is what you are looking for :)
Response.ContentType = "text/plain";
Upvotes: 4
Reputation: 32371
Just remove all the HTML except:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CSRValidationConnector._Default" %>
and in your codebehind Page_Load do a Response.Write("String")
Upvotes: 4