Web| Program | Fault tolerance first design a fault-tolerant hint of the window image as follows:
The key HTML text is as follows:
"Reason: <%=content[int32.parse (request.querystring[" MS "])]%>"
Then add the following in the Code editing window:
public class WebForm1:System.Web.UI.Page
{
Public string[] content;
private void Page_Load (object sender, System.EventArgs e)
{
Content=new STRING[10];
content[1]= ". Hint 1.";
content[2]= "Hint 2";
... ...
}
===========================================
This is called in a fault-tolerant Web page:
[/* Below is an example!) */]
public void Check ()
{//Check the legality of user input;
Detects if the order number [type] is blank;
if (lOrderName.InnerText.Trim () = = "" | | LOrderCategory.InnerText.Trim () = = "")
{
Response.Redirect (@ "...) \exceptions.aspx?ms=11 ");
}
Determine whether the number of users input is correct;
Try
{
int i = convert.toint16 (Tbquantity.text);
if (i ==0)
{
Response.Redirect (@ "...) \exceptions.aspx?ms=12 ");
}
}
Catch
{
Response.Redirect (@ "...) \exceptions.aspx?ms=12 ");
}
Determine whether the date is correct;
Try
{
Convert.todatetime (Tbterm.text);
}
Catch
{
Response.Redirect (@ "...) \exceptions.aspx?ms=9 ");
}
To determine the delivery time must be greater than the opening date;
if (Convert.todatetime (Tbterm.text) < Convert.todatetime (request.cookies["order"). values["Date"])
{
Response.Redirect (@ "...) \exceptions.aspx?ms=14 ");
}
Determine if the current model already exists in the current order;
DataClass dc = new DataClass ();
if (DC. Checkmodel (Lordername.innertext,lbmodel.selectedvalue.tostring ()))
{
Response.Redirect (@ "...) \exceptions.aspx?ms=13 ");
}
When the order type is: "S-p", the detection can not exceed the limit;
if (lordercategory.innertext== "S-p")
{
if (Convert.ToInt32 (Tbquantity.text) > Convert.ToInt32 (lbupper.innertext))
{
Response.Redirect (@ "...) \exceptions.aspx?ms=18 ");
}
}
}
==========================================
Where exceptions.aspx is the fault-tolerant window we just defined!
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.