Reputation: 3378
I get the following error; The name 'Request' does not exist in the current context
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);
}
}
}
I'm an absolute newbie and have researched the error but am confused as to which assembly I might be missing as a reference.
Upvotes: 5
Views: 13286
Reputation: 1988
issue may be here
var request = HttpContext.Current.Request.QueryString["source"];
HttpRequest q = Request;
your variable name is request bt you are using Request
change this as
var request = HttpContext.Current.Request.QueryString["source"];
HttpRequest q = request;
this wil solve your issue
Upvotes: 5
Reputation: 2868
If you are meaning HttpWebRequest, you should include the namespace using System.Net;
Upvotes: -1
Reputation: 6975
Change this line:
class Ex15_CreateMeetingOnBehalfOfPrinciple_CS
to this:
class Ex15_CreateMeetingOnBehalfOfPrinciple_CS : System.Web.UI.Page
It looks like the problems you're getting are from properties you should be inheriting from that class.
Upvotes: 0