日期:2014-05-18  浏览次数:20795 次

如何在HttpHandler中为页面增加Request参数
根据业务需要,做了一个HttpHandler,主要处理一个参数,处理完后将这个参数要加到Request中,便于aspx页面调用

如在HttpHandler中写一个名为domain的参数

在index.aspx页中在要能取到Reqeust["domain"]


请问怎么样才能把domain的参数写到request里去啊,最好不要使用在页面地址后面附加domain参数

------解决方案--------------------
加到HttpContext.Items里面吧,干嘛非要加到Request里面呢
------解决方案--------------------
把参数放Session里边。用Session前后台交互数据。
------解决方案--------------------
竟然有人叫我这么
英俊潇洒风流倜傥的大大大大大帅哥
大姐
叫姐夫还差不多

C# code

using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace _Test {
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Handler1 : IHttpHandler {

        public void ProcessRequest(HttpContext context) {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
            // Resuest
            context.Request.Form[0];
        }

        public bool IsReusable {
            get {
                return false;
            }
        }
    }
}