每当我管理比绍的ASPX页面时,我都收到内部服务器Error。 这是我从“网吧”中复制的一件事。
ASPX 页: 1
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="x.aspx.cs" Inherits="x" %>
<!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 id="Head1" runat="server">
<title>Adventure Works</title>
<style type="text/css">
.loading
{
background-image: url( ajax-load.gif );
background-repeat: no-repeat;
}
</style>
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
function CallService() {
$( input[type=button] ).attr( disabled , true);
$("#CustDetails").html( );
$("#CustDetails").addClass("loading");
$.ajax({
type: "POST",
url: "GetVendor.asmx/GetVendorDetails",
data: "{ ID : " + $("#txt_id").val() + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
function OnSuccess(data, status) {
alert( success );
$("#CustDetails").removeClass("loading");
// $("#textVendorNameLookup").html(data.d);
$( input[type=button] ).attr( disabled , false);
}
function OnError(request, status, error, response) {
$("#CustDetails").removeClass("loading");
$("#CustDetails").html(request.statusText);
$( input[type=button] ).attr( disabled , false);
//$("#textVendorNameLookup").html(request.statusText);
}
}
</script>
</head>
<body>
<form id="DocForm" runat="server">
<div>
<table style="width:31%;">
<tr>
<td>
Enter Contact ID</td>
<td>
:</td>
<td>
<input id="txt_id" value="12" type="text" /><input id="btnGo" type="button"
value="Get Details" onclick ="CallService(); return false;"/></td>
</tr>
</table>
<br />
<div id="CustDetails" style="width: 60%; height: 75px;">
</div>
</div>
</form>
</body>
</html>
ASMX
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
/// <summary>
/// Summary description for AdvService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class GetVendor : System.Web.Services.WebService {
public GetVendor () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
public int GetVendorDetails(int id)
{
return id;
}
}
The CS page;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using System.Reflection;
public partial class x : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
AHIA, Larry...