Example:
The following code example demonstrates how to use the BackgroundWorker component to load an XML file from a URL. When the user clicks the Download button, the Click event handler invokes the RunWorkerAsync method of the BackgroundWorker
Get the IP address of the client, the code is as follows:
Copy Code code as follows:
Get Client IP Address
public string Getclientip ()
{
String userip = request.servervariables["Http_x_forwarded_for"];
if (Userip =
①, data Format validation control (RegularExpressionValidator)
Copy Code code as follows:
A pattern match is made to the control you want to validate by customizing the regular expression.
Take the previous piece of code for
1. Recycling of application pools causes the site to be restarted, as recorded by:
Hostingenvironment initiated shutdown hostingenvironment caused shutdown
2. Modifying the application pool recycle rule causes the restart, and the logged restart
And we can also remove some whitespace
Paragraphs, blank lines, comments, and so on to make the size of the HTML document smaller. Let's first implement the compression and deletion of whitespace classes, inheriting from the Stream class:
Copy Code code as follows:
public class Bscookie
{
Cookie for Action
Private HttpCookie _thecookie;
The name of the corresponding cookie
private string _cookiename;
private bool _httponly = true;
Allow access only on server side,
Use Ajaxmethod to satisfy a few points:
1. If you don't have a ajax.dll file, download the first one to
2. To add Ajax.dll to a project reference: Right-click the project name-"Add Project Reference" in the VS Solution Explorer-Browse, find Ajax.dll
The solution is:
Copy Code code as follows:
The called page in www.B.com needs to write a P3P header to unblock ie from writing cookies
Context. Response.AddHeader ("P3P", "Cp=cao PSA our");
Www.A.com in the www.B.com through Ajax
The performance loss of this mechanism is that the server's asp.net still receive requests and process requests. The mechanism in this article is to let the browser decide whether to read the cache itself, so that the request for the server is
If the page simply use JS to create, to write a large number of code, and not intuitive.
In asp.net, we can actually create user-defined controls that return user-defined HTML code through AJAX requests.
Copy Code code as follows:
public
1, static template page template.html, mainly defines a number of special characters, used to be replaced.
Copy Code code as follows:
title
Title
Browse time
Content
Pager
View more
The steps for the IIS7 site to start and process the request are shown below:
Steps 1 through 6, is to process the application startup, after the boot is good, no longer need to go this step.
The 8 steps in the above diagram are as follows:
1. Brief introduction
ID is the ID you specify when designing, is the programming identifier we assign to the server control, we often use This.controlid to find the control, then this controlid is the ID here.
ClientID is the client-side
The sample code for the foreground is as follows, using the DataList control, to display the StudentID and names in the student table
Copy Code code as follows:
' visible= ' false ' >
Adding "path= expiration" to the JS method solves this problem.
For example://write cookies
Copy Code code as follows:
function Setcookie (name,value)
{
Document.cookie = Name "=" Escape (value) ";p ath=/"; Set the cookie to turn off
All the code is as follows.
Copy Code code as follows:
JSON parsing class
public static Class JsonConvert
{
#region Global Variables
private static Jsonobject _json = new Jsonobject ();//Registers
private static readonly
Add caching support to the data tier, business logic tier, UI, or output layer. Memory is now very cheap-therefore, a great performance improvement can be achieved by implementing caching in the entire application in an intelligent manner. Caching
The so-called postback mechanism, in fact, is to send themselves to their own (this page) just. Below we create a new Web site, open the default added Default.aspx page, the form part of the code is as follows:
Copy Code code as follows:
Starting at ASP.net 3.5,. NET platform supports two kinds of serialization methods:
Copy Code code as follows:
1.DataContractSerializer
2.JavascriptSerializer
The former is mainly serialized according to the Data Contract
However, the problem is that the subjects of different departments are not the same, then we are in the database design is usually the students, a certain subjects as a record, then we need to do a row of the logical processing of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service