为什么我的代码隐藏不执行?

时间:2012-06-11 20:19:46

标签: c# asp.net

我正在尝试在以下请求中输出x的值:http://localhost:4827/Default.aspx?x=123123

我根本没有输出。 这是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

using MPads.Common;
using MPads.WebPatientPortal.Interfaces;
using MPads.WebPatientPortal.Presenters;
using MPads.BusinessLogic.Interfaces;
using MPads.Components.Interfaces;
using MPads.DataAccess;

using MPads.DataAccess.Interfaces;
using System.Text;
using System.Diagnostics;


namespace MPads.WebPatientPortal
{
    public partial class Default : System.Web.UI.Page, IDefault
    {


        private DefaultPresenter _presenter;

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            _presenter = new DefaultPresenter();

            var fields = Request.QueryString;

            if (fields.Count > 0)
            {
                var x = Utilities.GetNvpValue(fields, "x").ToString();
                Trace.Write(x);
            }


        }


        public void loadAjaxContent(string content)
        {
            Page.RegisterStartupScript("myScript", " <script type=\"text/javascript\"> loadAjaxContent('" + content + "','POST',null); </script>");
        }

        public void DisplayMessage(string message)
        {
        }



    }
}

2 个答案:

答案 0 :(得分:2)

你在ASPX中设置了偶数处理程序吗?

假设您这样做:使用Trace.Write();

考虑代替Response.Write();

Trace.Write();写入跟踪侦听器(您可以在页面底部显示)。

Response.Write();直接将文本结果输出到您的页面,而不是通过Trace Listener。

答案 1 :(得分:0)

使用Glimpse找到这个,这里是链接Glimpse-A client side Glimpse to your server