2011-09-24 131 views
1

我從下面的http處理程序中收到以下錯誤。 其他ashx文件正在工作。 告訴我,如果你需要更多的信息.​​..ashx錯誤http處理程序

Server Error in '/einUsername' Application. 

Parser Error 

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not create type 'WebApplication18.Handler1'. 

Source Error: 


Line 1: <%@ WebHandler Language="C#" CodeBehind="Handler.ashx.cs" Class="WebApplication18.Handler1" %> 

Source File: /einUsername/Handler.ashx Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

代碼

using System; 
using System.IO; 
using System.Text; 
using System.Net; 
using System.Web; 

public partial class csIPNexample : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 

     // logging ipn messages... be sure that you give write 
     // permission to process executing this code 
     string logPathDir = ResolveUrl("Messages"); 
     string logPath = string.Format("{0}\\{1}.txt", 
         Server.MapPath(logPathDir), DateTime.Now.Ticks); 
     File.WriteAllText(logPath, "hi"); 
     // 

    } 
} 

回答

1

錯誤信息的類別是「WebApplication18.Handler1」,但它是你提供的「csIPNexample」中的代碼。你確定你發佈了正確的代碼嗎?

+0

是,http://aspspider.net/einUsername%5cHandler1.ashx // ASP .NET C# ... 公共部分類Handler1:System.Web.UI.Page { 保護無效的Page_Load(對象發件人,EventArgs e) { //記錄ipn消息...確保你寫 //許可處理執行此代碼 字符串logPathDir = ResolveUrl(「Messages」); string logPath = string.Format(「{0} \\ {1} .txt」, Server.MapPath(logPathDir),DateTime.Now.Ticks); File.WriteAllText(logPath,「hi」); // } } – einUsername