在C#中使用Request对象时出现错误 [英] I'm having an error when i use the Request object in c#

查看:99
本文介绍了在C#中使用Request对象时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;




 protected override void InitializeCulture()
        {
            base.InitializeCulture();
            string cult = request["DropdownList1"];
            if (cult != null)
            {
                Culture = cult;
                UICulture= cult;
            }
        }



当我运行上述代码错误时,我得到的是名称请求在当前上下文中不存在".所以我尝试HttpContext.Current.string cult = request["DropdownList1"];仍然无法正常工作.我在顶部缺少任何参考吗,那是什么?还是我必须添加任何装配体作为参考,然后它是什么?



when i run the above code error i get is " the name Request does not exist in the current context". so i tried HttpContext.Current.string cult = request["DropdownList1"]; still not working. am i missing any reference at the top then what it is? or do i have to add any asemblies as a reference then what it is?

推荐答案

请尝试以下方法:

Try this instead:

string cult = HttpContext.Current.Request["DropdownList1"]


这篇关于在C#中使用Request对象时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆