好费解的异常。小弟我直接在IE输入URL正确。用异步调用 500 异常
好费解的错误。。我直接在IE输入URL正确。用异步调用 500 错误
错误网页:http://www.*****.com/askShow.aspx?Ask_Auto=true - 500
错误信息:未将对象引用设置到对象的实例。
堆叠内容:
在 System.Web.UI.Page.HandleError(Exception e)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest()
在 System.Web.UI.Page.ProcessRequest(HttpContext context)
在 ASP.askshow_aspx.ProcessRequest(HttpContext context) 位置 c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\323c5da0\6aaee31\App_Web_askshow.aspx.cdcab7d2.ovdeafwn.0.cs:行号 0
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
------解决方案--------------------
帮顶下好了。来到这个论坛发现什么也不会。
错误网页:http://www.*****.com/askShow.aspx?Ask_Auto=true - 500
错误信息:未将对象引用设置到对象的实例。
堆叠内容:
在 System.Web.UI.Page.HandleError(Exception e)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest()
在 System.Web.UI.Page.ProcessRequest(HttpContext context)
在 ASP.askshow_aspx.ProcessRequest(HttpContext context) 位置 c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\323c5da0\6aaee31\App_Web_askshow.aspx.cdcab7d2.ovdeafwn.0.cs:行号 0
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
public delegate void AsyncDelegateGetPage();
AsyncDelegateGetPage ad = new AsyncDelegateGetPage(AsyncForwardUrl);//实例化委托类型
ad.BeginInvoke(null, null);//开始调用
public void AsyncForwardUrl()
{
/********************/
System.Threading.Thread.Sleep(1000);
GetWebHtml GetWebHtml1 = new GetWebHtml();
String html = GetWebHtml1.GetWebHtmlString("http://www.*****.com/askShow.aspx?Ask_Auto=true");
}
/// 获取指定网页中的源数据
public string GetWebHtmlString(string Url, string Enc)
{
try{
string rl;
WebRequest Request = WebRequest.Create(Url);
WebResponse Response = Request.GetResponse();
Stream resStream = Response.GetResponseStream();
StreamReader sr = new StreamReader(resStream, Encoding.GetEncoding(Enc));
StringBuilder sb = new StringBuilder();
while ((rl = sr.ReadLine()) != null)
{
sb.Append(rl);
}
return sb.ToString();//抓取得到的源网页
//Match TitleMatch = Regex.Match(sb.ToString(), "<title>([^<]*)</title>", RegexOptions.IgnoreCase | RegexOptions.Multiline);//获取网页的标题
//string title = TitleMatch.Groups[1].Value;
}catch{
return "";
}
}
------解决方案--------------------
帮顶下好了。来到这个论坛发现什么也不会。