我收到以下错误;
当前上下文中不存在名称“请求”
using System;
using System.Web;
using System.Web.UI;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Microsoft.Exchange.WebServices.Data;
namespace Exchange101
{
// This sample is for demonstration purposes only. Before you run this sample, make sure that the code meets the coding requirements of your organization.
class Ex15_CreateMeetingOnBehalfOfPrinciple_CS
{
static ExchangeService service = Service.ConnectToService(UserDataFromConsole.GetUserData(), new TraceListener());
protected void Page_Load(object sender, EventArgs e)
{
var request = HttpContext.Current.Request.QueryString["source"];
HttpRequest q = Request;
NameValueCollection n = q.QueryString;
if (n.HasKeys())
{
string k = n.GetKey(0);
if (k == "one")
{
string v = n.Get(0);
}
if (k == "two")
{
string v = n.Get(0);
}
}
}
我是一个绝对的新手并且已经研究过这个错误,但是对于我可能缺少哪个程序集作为引用感到困惑。
最佳答案
问题可能在这里
var request = HttpContext.Current.Request.QueryString["source"];
HttpRequest q = Request;
你的变量名是 request bt 你正在使用 Request
将此更改为
var request = HttpContext.Current.Request.QueryString["source"];
HttpRequest q = request;
这将解决您的问题
关于c# - "The name does not exist in the current context",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22801182/