1. Query String.
Client URL:
http://localhost:8088/TableTopic/Post.aspx?id=12345678&name=andrewzhu
Server Side:
public partial class Post : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (IsPostBack)
return;
body.Text = this.Request.QueryString["name"];
}
}
2. Why do we need <!doctype>
To make sure Web Browser render the page correctly. or make rendering faster.
3. Use ASP.NET FileUpload control.
In aspx page, we add two controls
<asp:FileUpload ID="fileUpload" runat="server" />
<asp:Button ID="uploadButton" runat="server" Text="Upload"
onclick="uploadButton_Click" />
In the behind cs file, add the following code for the upload button click event.
protected void uploadButton_Click(object sender, EventArgs e) {
if (!fileUpload.HasFile)
return;
try {
string fileName = Path.GetFileName(fileUpload.FileName);
fileUpload.SaveAs(Server.MapPath("~/App_Data/Pictures/") + fileName);
statusLabel.Text = "file saved";
} catch (Exception) {
throw;
}
}
4. Separate page with a vertical line:
<table border="0" cellpadding="0" cellspacing="0" width="500">
<tr>
<td width="50%" valign="top" align="left">
<p>The main page content here </p>
</td>
<td width="50%" valign="top" align="left"
style="border-left: 1px solid cyan; padding: 5px;">
</td>
</tr>
</table>
5.IHttpHandler.IsReusable
Set the property to true, if the HttpHandler instance is reusable. When the http handler needs heavy initailization. we set IsReusable to true to pool the instance. so that this handler can serve request fast.
6.What is AutoEventWireup
http://forums.asp.net/t/932513.aspx/2/10
7. Page close event
window.onbeforeunload = function () {
$.post("http://path",
{ para:value,para2:value2 },
function (data) {
});
}
07615006-1fd7-44d0-bde7-d52e8d605c8c|1|5.0
ASPNET