Quick refresh. From php/mySQL to ASP.NET again takes a quick head rethread.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

string strReturn = "";

if (!IsPostBack)
{
strReturn += "Not a post back<br>\n";
}
else
{
strReturn += "Post back<br>\n";
}

strReturn += Request.QueryString.Count + " :: " + Request.Form.Count + "<br>";


if (null == Request.Form["spam"]) {
strReturn += "nullige<br>\n";
}
else
{
strReturn += "<h2>" + Request.Form["spam"] + "</h2>\n";
}

foreach (string strKey in Request.Form.Keys)
{
strReturn += strKey + " :: " + Request.Form[strKey] + "<br>\n";
}

foreach (string strKey in Request.QueryString.Keys)
{
strReturn += strKey + " || " + Request.QueryString[strKey] + "<br>\n";
}


Response.Write(strReturn);
}
}
}



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication2._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>
<input runat="server" type="text" name="nameIsWorthlessOnServer" id="spam" value="pow" /><br />
<input type="submit" runat="server" />
</div>
</form>
</body>
</html>

Labels: , ,