Asp.net 编译器错误消息:CS1513

Asp.net 编译器错误消息:CS1513,asp.net,Asp.net,编译错误 描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码 编译器错误消息: CS1513:}应为空 源错误: Line 132: protected void Button1_Click(object sender, EventArgs e) Line 133: { Line 134: string url = "gdata.youtube.com/feeds/api/videos/fhWaJi1Hsfo/comments"; Line

编译错误

描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码

编译器错误消息:

CS1513:}应为空

源错误:

Line 132:    protected void Button1_Click(object sender, EventArgs e)
Line 133:    {
Line 134:       string url = "gdata.youtube.com/feeds/api/videos/fhWaJi1Hsfo/comments";
Line 135:       string ReadTextFromUrl(string url) 
Line 136:       {

看起来您有一个方法嵌入到另一个方法中。您需要分离这些方法,然后适当地调用它:

protected void Button1_Click(object sender, EventArgs e)
{
    string url = "gdata.youtube.com/feeds/api/videos/fhWaJi1Hsfo/comments";
    string result = ReadTextFromUrl(url);
}

string ReadTextFromUrl(string url) 
{
    // code here
}