我原以为这可能是因为一个页面是我修改过的另一个页面的副本。但是,继承属性是正确的。当我访问Visual Studio中的页面或浏览器中的visual studio文件地址(在构建中)时,页面打开正常。但是,当我发布时,我收到错误404.0说明"您要查找的资源已被删除,名称已更改或暂时不可用。" 然后它显示物理路径。我已经确认文件在那里,应该在文件中。此解决方案共有8个页面,其他6个页面都有效。
不确定要显示的代码,但这里是一页的所有代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
public partial class EditRef : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("server=AVOKADB1; Initial Catalog=AvokaItemDev;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Calendar1.Visible = false;
}
}
protected void btnPopulate_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comPopulate;
String strPopulate;
//Start Code from here
//con.Open();
//Query Coding for stem and old id
strPopulate = "select * from [references] where ref_code='" + searchRefTextBox.Text + "' or title = '" + searchTitleTextBox.Text + "'";
comPopulate = new SqlCommand(strPopulate, con);
SqlDataReader readerPopulate = comPopulate.ExecuteReader();
if (readerPopulate.Read())
{
refCodeTextBox.Text = readerPopulate["ref_code"].ToString();
titleTextBox.Text = readerPopulate["Title"].ToString();
editionTextBox.Text = readerPopulate["Edition"].ToString();
authorTextBox.Text = readerPopulate["Author"].ToString();
publisherTextBox.Text = readerPopulate["Publisher"].ToString();
yearPublishedTextBox.Text = readerPopulate["Year"].ToString();
isbnTextBox.Text = readerPopulate["ISBN"].ToString();
publishedDateTextBox.Text = readerPopulate["published_date"].ToString();
existingMarketSegmentTextBox.Text = readerPopulate["market_segment_id"].ToString();
notesTextBox.Text = readerPopulate["Notes"].ToString();
readerPopulate.Close();
}
else readerPopulate.Close();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmdSubmit = new SqlCommand("Update [references] set ref_code = @Refcode, market_segment_id = (select distinct m.market_segment_id from market_segment m left join item_header h on m.market_segment_id = h.market_segment_id where m.market_segment_name = @MarketSegment), Title = @Title, Edition = @Edition, Author = @Author, Publisher = @Publisher, Year = @Year, ISBN = @ISBN, published_date = @PublishedDate, notes = @Notes, modified_datetime = getdate() where ref_code = '" + searchRefTextBox.Text + "'", con);
cmdSubmit.Parameters.AddWithValue("@RefCode", refCodeTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@MarketSegment", marketSegmentDDL.SelectedValue);
cmdSubmit.Parameters.AddWithValue("@Title", titleTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@Edition", editionTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@Author", authorTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@Publisher", publisherTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@Year", yearPublishedTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@ISBN", isbnTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@PublishedDate", publishedDateTextBox.Text);
cmdSubmit.Parameters.AddWithValue("@Notes", notesTextBox.Text);
cmdSubmit.ExecuteNonQuery();
cmdSubmit.Parameters.Clear();
string msgstring = "You Have Successfully Edited a Reference";
string content = "window.onload=function(){ alert('";
content += msgstring;
content += "');";
content += "window.location='";
content += Request.Url.AbsoluteUri;
content += "';}";
ClientScript.RegisterStartupScript(this.GetType(), "SucessMessage", content, true);
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
publishedDateTextBox.Text = Calendar1.SelectedDate.ToShortDateString();
Calendar1.Visible = false;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Calendar1.Visible = true;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditRef.aspx.cs" Inherits="EditRef" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
}
.auto-style2 {
color: #FFFFFF;
font-family: Georgia;
}
.auto-style3 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
}
</style>
</head>
<body>
<form id="form1" runat="server" style="background-color:#E6E6FA">
<div>
<strong>
<asp:Label ID="enterRefLbl" runat="server" BackColor="#0066FF" CssClass="auto-style2" Font-Bold="True" Font-Size="Larger" Text="Populate Reference Data" Width="969px"></asp:Label>
<br />
<br />
<asp:Label ID="lblSearchRef" runat="server" Text="Search by RefCode"></asp:Label>
<asp:Label ID="lblTitleSearch" runat="server" Text="Search by Title"></asp:Label>
<br />
<asp:TextBox ID="searchRefTextBox" runat="server" Width="227px"></asp:TextBox>
<asp:TextBox ID="searchTitleTextBox" runat="server" Width="365px"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnPopulate" runat="server" OnClick="btnPopulate_Click" Text="Populate Fields" />
<br />
<br />
<br />
<asp:Label ID="lblDataBelow" runat="server" BackColor="#0066FF" CssClass="auto-style3" Text="Edit Existing Reference Data Below" Width="969px"></asp:Label>
<br />
<br />
<asp:Label ID="lblRefCode" runat="server" Text="Ref Code"></asp:Label>
<asp:Label ID="lblExistingMarketSegment" runat="server" Text="Existing Market Segment"></asp:Label>
<asp:Label ID="lblMarketSeg" runat="server" Text="New Market Segment"></asp:Label>
<br />
<asp:TextBox ID="refCodeTextBox" runat="server"></asp:TextBox>
<asp:TextBox ID="existingMarketSegmentTextBox" runat="server" Width="201px"></asp:TextBox>
<asp:DropDownList ID="marketSegmentDDL" runat="server" DataSourceID="SqlDataSource1" DataTextField="market_segment_name" DataValueField="market_segment_name">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AvokaItemDevConnectionString %>" SelectCommand="SELECT [market_segment_name] FROM [market_segment]"></asp:SqlDataSource>
<br />
<asp:Label ID="lblTitle" runat="server" Text="Title"></asp:Label>
<asp:Label ID="lblEdition" runat="server" Text="Edition"></asp:Label>
<br />
</strong>
<asp:TextBox ID="titleTextBox" runat="server" Width="580px"></asp:TextBox>
<asp:TextBox ID="editionTextBox" runat="server"></asp:TextBox>
<br />
<br />
<strong>
<asp:Label ID="lblAuthor" runat="server" Text="Author"></asp:Label>
<br />
</strong>
<asp:TextBox ID="authorTextBox" runat="server" Width="580px"></asp:TextBox>
<br />
<br />
<strong>
<asp:Label ID="lblPublished" runat="server" Text="Publisher"></asp:Label>
<br />
</strong>
<asp:TextBox ID="publisherTextBox" runat="server" Width="580px"></asp:TextBox>
<br />
<br />
<strong>
<asp:Label ID="lblYearPub" runat="server" Text="Year Published"></asp:Label>
<asp:Label ID="lblIsbn" runat="server" Text="ISBN"></asp:Label>
<br />
</strong>
<asp:TextBox ID="yearPublishedTextBox" runat="server"></asp:TextBox>
<asp:TextBox ID="isbnTextBox" runat="server"></asp:TextBox>
<br />
<br />
<strong>
<asp:Label ID="lblPublishedDate" runat="server" Text="Published Date"></asp:Label>
</strong>
<br />
<asp:TextBox ID="publishedDateTextBox" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" Height="25px" ImageUrl="~/Images/icon-datepicker[1].png" Width="19px" ForeColor="#FF6666" OnClick="ImageButton1_Click" />
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged" BackColor="White" BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" Width="220px">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
<TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
<TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
<WeekendDayStyle BackColor="#CCCCFF" />
</asp:Calendar>
<br />
<br />
<strong>
<asp:Label ID="lblNotes" runat="server" Text="Notes(Use NO line breaks)"></asp:Label>
<br />
</strong>
<asp:TextBox ID="notesTextBox" runat="server" Width="580px"></asp:TextBox>
<br />
<br />
<strong>
<asp:Button ID="btnSubmit" runat="server" BackColor="#0066FF" CssClass="auto-style1" Text="Submit" OnClick="btnSubmit_Click" />
</strong>
</div>
</form>
</body>
</html>