Hi,
Would like to know what is the best way of creating an ASP.Net web page that
return just a line of "Text".
This ASP.Net will not required any HTML tag, or Post Back Features.
So we created below in Code Behind:
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
Response.Clear();
Response.ContentType = "text/plain";
// Some Business Logic
Response.Write(sometext)
}
Is this the best way? The return result "sometext" will be used by
javascript (Ajax). But we still have this in our Form Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs"
Inherits="CUST_Test._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>
Shall i remove all above from the Form Code?
Instead of protected override void Render(HtmlTextWriter writer), can we
just do something like this (probably in the Form Code):
<%
Response.Clear();
Response.ContentType = "text/plain";
// Some Business Logic
Response.Write(sometext)
%>
and then remove all Code Behind and everything, will that improve
performance?
Really appreciate if you can help. Millions Thanks!