调用方法时从页面加载事件中获取错误
问题描述:
大家好,
i当我尝试运行我从页面加载事件调用的方法时出现此错误,这是错误来自的地方;
Hi all,
i am getting this error when i try to run a method which i am calling from my page load event, this is where the error is coming from;
protected void Page_Load(object sender, EventArgs e)
{
EnvironmentSpecificRequestUrl();
}
private void EnvironmentSpecificRequestUrl()
{
throw new NotImplementedException();
}
这是我的代码:
here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class test123 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
EnvironmentSpecificRequestUrl();
}
public static Uri EnvironmentSpecificRequestUrl(HttpRequestBase request)
{
//.........
//........
}
}
请告诉我错误的地方。
谢谢提前
please let me know where am stuck up the error.
thanks in advance
答
我不确定你说的实际错误是什么,但我在你的代码片段中看到两个问题。
在第一个块中,你抛出一个NotImplementedException
,这本身就是错误的(故意)原因。
在第二个块中,签名:public static Uri EnvironmentSpecificRequestUrl(HttpRequestBase request)
与您调用的签名不匹配with,没有参数。
I'm not sure you stated what the actual error is, but I see two problems in your code snippets.
In the first block, you are throwing aNotImplementedException
, which not surprisingly is itself the (intentional) cause of the error.
In the second block, the signature:public static Uri EnvironmentSpecificRequestUrl(HttpRequestBase request)
does not match the signature that you are calling with, which has no arguments.