本文介绍了实时服务器上的验证问题......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嘿伙计..我的项目中有一个奇怪的问题..我有一个asp页面,我有服务器端验证,他们工作正常。我在实时服务器上托管了该页面。测试。工作。几天后有人违反了验证..没有输入任何数据,仍然被预订。当我看到报告时,姓名,国家等领域都没有。然后我再次测试它,它的工作正常,但那个预订怎么样???我们可以讨论,但不要忽视这个.. PLZ .. 一些aspx代码: < table width = 700 border = 0 cellspacing = 1 对齐 = center class = style1 style = 保证金:自动; > < tr > < td class = formsname > 名字 < / td > < td width = 315px > < asp:TextBox ID = txtFname runat = server CssClass = formsinput > < / asp:TextBox > < cc1:FilteredTextBoxExtender ID = FilteredTextBoxExtender3 runat = server FilterType = LowercaseLetters,UppercaseLetters TargetControlID = txtFname / > < / td > < td align = left valign = top 样式 = vertical-align:middle; > < asp:RequiredFieldValidator ID = RequiredFieldValidator1 runat = server ErrorMessage = * 显示 = 动态 ForeColor = 红色 ValidationGroup = vgReg 字体-Size = 16px ControlToValidate = txtFname > < / asp:RequiredFieldValidator > < / td > < / tr > < tr > < td class = formsname > 姓氏 < / td > < td style = vertical-align:middle; > < asp:TextBox ID = txtLname runat = server CssClass = formsinput > < / asp:TextBox > < cc1:FilteredTextBoxExtender ID = FilteredTextBoxExtender4 runat = server FilterType = LowercaseLetters,UppercaseLetters TargetControlID = txtLname / > < / td > < td > < asp:RequiredFieldValidator ID = rfLname runat = server ErrorMessage = * 显示 = 动态 ForeColor = 红色 ValidationGroup = vgReg 字体大小 = 16px ControlToValidate = txtLname > < / asp:RequiredFieldValidator > < / td > < / tr > < / table > 按键代码: < asp:按钮 ID = btnConfirm runat = server 文字 = 继续支付 ValidationGroup = vgReg 样式 = width:153px; class = btn OnClick = btnConfirm_Click / > 保存逻辑 受保护 void btnConfirmAdmin_Click( object sender,EventArgs e) { / / Imad于2013年11月12日发布的管理员预订代码 尝试 { PersonalDetailList objpersonal = new PersonalDetailList(); ValidateSession(); int _noOfperson = 0 ; int .TryParse(txtNoOfPerson.Text.Trim(), out _noOfperson); BookingDetailList _objBookingDtl =(BookingDetailList)会话[ Bookingdetail]; if (_objBookingDtl!= null ) { List< BookingList> lslBookingRooms = new List< BookingList>(); if (会话[ Bookingrooms]!= null ) { lslBookingRooms =(List< BookingList>)Session [ Bookingrooms]; DataTable dt = UitilityGeneric.ToDataTable< BookingList>(lslBookingRooms); DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.Tables [ 0 ]。TableName = SampleDataTable; 字符串 XMLString = ; XMLString = ds.GetXml(); string _Country = Request.Form [ ctl00 $ $搜索Maincontent ddlCountry]; string _State = Request.Form [ ctl00 $ $搜索Maincontent ddlstate]; objpersonal.FirstName = txtFname.Text.Trim(); objpersonal.LastName = txtLname.Text.Trim(); objpersonal.BillingAddress = txtBillingAddress.Text.Trim(); objpersonal.City = txtCity.Text.Trim(); objpersonal.State = _State == 0? :_ State; // ddlstate.SelectedValue; // txtState.Text.Trim(); objpersonal。 PostalCode = txtPostalCode.Text.Trim(); objpersonal.Country = _Country; // ddlCountry.SelectedValue; objpersonal。 Phone = txtPhone.Text.Trim(); objpersonal.Email = txtEmail.Text.Trim(); objpersonal.NoOfPerson = _noOfperson; // objpersonal.Amount = _objBookingDtl.Amount; objpersonal.Vat = _objBookingDtl.Vat; objpersonal.BreakfastAmount = _objBookingDtl.BreakfastAmount; // objpersonal.TotalAmount = _objBookingDtl.TotalAmount; // objpersonal.CheckInDate = _objBookingDtl.CheckInDate; // objpersonal.CheckOutDate = _objBookingDtl.CheckOutDate; // objpersonal.IsOnlineBook = true ; objpersonal.IsAdminBook = true ; objpersonal.PaymentBy = 现金; // objpersonal.CCTypeId = 1; //Convert.ToInt64(ddlCCtype.SelectedValue); objpersonal.PaymentStatus = true ; / / 默认值= false当实施cc api objpersonal.BookingStatus = 1 ; // 默认值= 0 //实施cc api时会更改 objpersonal.IsMailSent = false ; objpersonal.CreatedBy = Convert.ToInt64(会话[ UserID]); long CustomerId = objBalBooking.InsertCustomerBooking(objpersonal,XMLString); 邮件(CustomerId); } } Response.Redirect( 〜/ Admin / listbooking.aspx ); } catch (例外情况) { string 错误= PersonalDetails.ascx.cs: - btnConfirmAdmin_Click(); 错误+ = ex.Message; string str = HttpContext.Current.Request.PhysicalApplicationPath + @ LogError\; LogError.Log_Error(Error,str); } } 解决方案 MainContent ddlCountry]; string _State = Request.Form [ ctl00 MainContent Hey guys.. I have strange problem in my project.. I have a asp page on which I have server side validations and they are working fine. I hosted that page on live server. tested. worked. after few days someone violated validations.. entered no data and still got booked. When I saw reports, there is nothing in Name, country etc field. then I tested it again, its working fine but what about that booking.. ?? We can have discussion but dont ignore this.. plz..Some aspx code:<table width="700" border="0" cellspacing="1" align="center" class="style1" style="margin: auto;"> <tr> <td class="formsname"> First Name </td> <td width="315px"> <asp:TextBox ID="txtFname" runat="server" CssClass="formsinput"></asp:TextBox> <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="LowercaseLetters, UppercaseLetters" TargetControlID="txtFname" /> </td> <td align="left" valign="top" style="vertical-align: middle;"> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" Display="Dynamic" ForeColor="Red" ValidationGroup="vgReg" Font-Size="16px" ControlToValidate="txtFname"></asp:RequiredFieldValidator> </td> </tr> <tr> <td class="formsname"> Last Name </td> <td style="vertical-align: middle;"> <asp:TextBox ID="txtLname" runat="server" CssClass="formsinput"></asp:TextBox> <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" FilterType="LowercaseLetters, UppercaseLetters" TargetControlID="txtLname" /> </td> <td> <asp:RequiredFieldValidator ID="rfLname" runat="server" ErrorMessage="*" Display="Dynamic" ForeColor="Red" ValidationGroup="vgReg" Font-Size="16px" ControlToValidate="txtLname"></asp:RequiredFieldValidator> </td> </tr></table>Button code:<asp:Button ID="btnConfirm" runat="server" Text="Proceed to pay" ValidationGroup="vgReg" Style="width: 153px;" class="btn" OnClick="btnConfirm_Click" />Save Logicprotected void btnConfirmAdmin_Click(object sender, EventArgs e) { //Admin booking code by Imad on 12/11/2013 try { PersonalDetailList objpersonal = new PersonalDetailList(); ValidateSession(); int _noOfperson = 0; int.TryParse(txtNoOfPerson.Text.Trim(), out _noOfperson); BookingDetailList _objBookingDtl = (BookingDetailList)Session["Bookingdetail"]; if (_objBookingDtl != null) { List<BookingList> lslBookingRooms = new List<BookingList>(); if (Session["Bookingrooms"] != null) { lslBookingRooms = (List<BookingList>)Session["Bookingrooms"]; DataTable dt = UitilityGeneric.ToDataTable<BookingList>(lslBookingRooms); DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.Tables[0].TableName = "SampleDataTable"; String XMLString = ""; XMLString = ds.GetXml(); string _Country = Request.Form["ctl00$MainContent$ddlCountry"]; string _State = Request.Form["ctl00$MainContent$ddlstate"]; objpersonal.FirstName = txtFname.Text.Trim(); objpersonal.LastName = txtLname.Text.Trim(); objpersonal.BillingAddress = txtBillingAddress.Text.Trim(); objpersonal.City = txtCity.Text.Trim(); objpersonal.State = _State == "0" ? "" : _State; //ddlstate.SelectedValue;//txtState.Text.Trim(); objpersonal.PostalCode = txtPostalCode.Text.Trim(); objpersonal.Country = _Country;//ddlCountry.SelectedValue; objpersonal.Phone = txtPhone.Text.Trim(); objpersonal.Email = txtEmail.Text.Trim(); objpersonal.NoOfPerson = _noOfperson;// objpersonal.Amount = _objBookingDtl.Amount; objpersonal.Vat = _objBookingDtl.Vat; objpersonal.BreakfastAmount = _objBookingDtl.BreakfastAmount;// objpersonal.TotalAmount = _objBookingDtl.TotalAmount;// objpersonal.CheckInDate = _objBookingDtl.CheckInDate;// objpersonal.CheckOutDate = _objBookingDtl.CheckOutDate;// objpersonal.IsOnlineBook = true; objpersonal.IsAdminBook = true; objpersonal.PaymentBy = "Cash"; // objpersonal.CCTypeId = 1; //Convert.ToInt64(ddlCCtype.SelectedValue); objpersonal.PaymentStatus = true;//default value=false This will Change when implement cc api objpersonal.BookingStatus = 1;//default value=0 //This will Change when implement cc api objpersonal.IsMailSent = false; objpersonal.CreatedBy = Convert.ToInt64(Session["UserID"]); long CustomerId = objBalBooking.InsertCustomerBooking(objpersonal, XMLString); Mail(CustomerId); } } Response.Redirect("~/Admin/listbooking.aspx"); } catch (Exception ex) { string Error = "PersonalDetails.ascx.cs:- btnConfirmAdmin_Click()"; Error += ex.Message; string str = HttpContext.Current.Request.PhysicalApplicationPath + @"LogError\"; LogError.Log_Error(Error, str); } } 解决方案 MainContentddlCountry"]; string _State = Request.Form["ctl00MainContent 这篇关于实时服务器上的验证问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 07:49