我已经建立了一个简单的ASP.net网站,一切都在我的电脑上正常运行。但是在我的同事的电脑上,虽然他使用相同的操作系统(Win 7)和与我相同的浏览器(IE9),但没有发布回发。
我现在无法访问他的计算机,这使得它很难调试。有人知道什么可以阻止一台计算机上的回发,虽然它们使用相同的浏览器在另一台计算机上工作吗? (我也在具有不同浏览器和操作系统的第三台计算机上尝试过,它也在那里工作)
//更新:部分代码
以下代码是出现问题的页面之一。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewList.aspx.cs" Inherits="QAList.NewList" %>
<!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>Items</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<link href="qalist.css" rel="stylesheet" type="text/css" />
<script src="lib/jquery-1.4.3.min.js" type="text/javascript"></script>
<script src="lib/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.5.custom.css" type="text/css" media="screen" charset="utf-8" />
<style type="text/css">
input[disabled]
{
background-color:#888888;
}
.Filled
{
width: 98%;
}
.Property
{ margin-bottom: 0px;
}
.Date
{
/* this class is only used to indicate that the value is a DateTime value */
}
.PropertyTable td
{
border-bottom: 1px solid #D8D8D8;
padding:1px;
background-color:#F6F6F6;
}
.Suppler_style
{
color: #0000BB;
}
</style>
<script type="text/javascript">
$(function () {
$(".Date").datepicker({ dateFormat: "yy/mm/dd" });
});
</script>
</head>
<body>
<form id="form1" runat="server">
<table style="width: 80%;" border="0" class="PropertyTable" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 227px;">
Project Number</td>
<td>
<asp:TextBox ID="ProjectNumber" runat="server" CssClass="Property" Width="200px"></asp:TextBox>
<asp:Button ID="btApplyPnr" runat="server" Text=" apply "
onclick="btApplyPnr_Click" />
</td>
</tr>
<tr>
<td>
Contract No.</td>
<td>
<asp:DropDownList ID="ddContractNo" runat="server" AutoPostBack="True"
onselectedindexchanged="ContractNo_SelectedIndexChanged"
CssClass="Filled">
</asp:DropDownList>
<input type="hidden" class="Property" id="V_QA_PO_tp_listId" runat="server" />
<input type="hidden" class="Property" id="V_QA_PO_tp_ID" runat="server" />
<input type="hidden" class="Property" id="ContractNo" runat="server" />
</td>
</tr>
<tr>
<td>
ITP No</td>
<td>
<asp:TextBox ID="ITPNo" runat="server" CssClass="Filled Property"></asp:TextBox>
</td>
</tr>
<tr>
<td class="Suppler_style">
ITP Name</td>
<td>
<asp:TextBox ID="ITPName" runat="server" CssClass="Filled Property"></asp:TextBox>
</td>
</tr>
<tr>
<td class="Suppler_style">
Status Delivery/Finish Date</td>
<td>
<asp:TextBox ID="StatusDeliveryFinishDate" runat="server"
CssClass="Filled Property Date"></asp:TextBox>
</td>
</tr>
</table>
</form>
</body>
</html>
C#-Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace QAList
{
public partial class NewList : System.Web.UI.Page
{
private string current_contract = "0";
private string current_pnr;
protected void Page_Load(object sender, EventArgs e)
{
current_contract = ddContractNo.SelectedValue;
}
protected void Page_PreRender(object sender, EventArgs e)
{
//load Contract Numbers
ddContractNo.Items.Clear();
ddContractNo.Items.Add(new ListItem("-", "0"));
foreach (DataRow contract in DBAccess.Instance.getContractNumbers(current_pnr).Rows)
{
ddContractNo.Items.Add(new ListItem(contract["ProjectNumber"] + " - " + contract["ContractNo"] + " - " + contract["GoodsServicesSupplied"], contract["tp_listId"] + "_" + contract["tp_ID"]));
}
try
{
ddContractNo.SelectedValue = current_contract;
}
catch (ArgumentOutOfRangeException)
{
ddContractNo.SelectedValue = null;
applyNewContractValue();
}
}
protected void ContractNo_SelectedIndexChanged(object sender, EventArgs e)
{
applyNewContractValue();
}
private void applyNewContractValue()
{
current_contract = ddContractNo.SelectedValue;
if (!String.IsNullOrEmpty(current_contract) && current_contract != "0")
{
Guid tp_listId = new Guid(current_contract.Split('_')[0]);
int tp_ID = Convert.ToInt32(current_contract.Split('_')[1]);
DataRow row = DBAccess.Instance.getContractInfos(tp_listId, tp_ID);
if (row == null)
return;
ITPName.Text = row.IsNull("GoodsServicesSupplied") ? "" : row["GoodsServicesSupplied"].ToString();
if (!row.IsNull("PlannedDeliveryexworks"))
{
DateTime tmp = (DateTime)row["PlannedDeliveryexworks"];
StatusDeliveryFinishDate.Text = tmp.Year + "/" + fillZeros(tmp.Month, 2) + "/" + fillZeros(tmp.Day, 2);
}
}
else
{
ITPName.Text = "";
}
}
private string fillZeros(int nr, int min_length)
{
string res = nr.ToString();
while (res.Length < min_length)
res = "0" + res;
return res;
}
protected void btApplyPnr_Click(object sender, EventArgs e)
{
current_pnr = ProjectNumber.Text;
}
}
}
答案 0 :(得分:1)
检查你的同事是否安装了一些脚本拦截器,这可以防止回发,因为它们是由Javascript驱动的。
答案 1 :(得分:0)
如果这有助于某人:
我发生了类似的事情,结果发现它是由于页面上的一些验证控件造成的。它们用于一些实际上不可见且未指定验证组的隐藏文本框。在其中一台计算机上,错误被忽略并且回发有效,而在第二台计算机上,由于验证错误,回发失败。由于文本框当前不可见,因此问题并不是很明显。
设置验证组后,问题就消失了。我不知道两台计算机上的行为有何不同,因为两台计算机都在Windows 10上运行Chrome。