c# system.net.httpwebrequest error

My head is swimming...

VS 2008 Express with c#
I have added System.Net in the References, and included "Using System.Net" in the service1.cs file.  I'm working in the service1.Designer.cs file.

Every indication is that you have to do:

HttpWebRequest objRequest;
objRequest = (HttpWebRequest)WebRequest.Create("http://www.mysite.com/x.aspx");

First of all,
HttpWebRequest objRequest;  <-- gives error

So I add the explicit reference to (Sytem.Net):

System.Net.HttpWebRequest objRequest;  <-- no error

I also added the reference in the "objRequest =" line but I *STILL* get an error on the WebRequest:

objRequest = (System.Net.HttpWebRequest)WebRequest.Create("http://www.mysite.com/x.asp");

The error is: WebRequest does not exist in the current context.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objRequest = (System.Net.HttpWebRequest)WebRequest.Create("http://www.mysite.com/x.asp");
objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.mysite.com/x.asp");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
snowdog_2112Author Commented:
I fxed it.  

First, I found syntax to make it work:

System.Net.HttpWebRequest objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(sURL);

This led me to believe the "using System.Net" was not inherited from the service1.cs file to the .designer file.

I had to include in the service1.designer.cs file:

using System;
using System.Configuration;
using System.Net;
using System.IO;

Now I can refer to them without referencing the full path.

snowdog_2112Author Commented:
See my post below this answer about including "using System.Net" in the service1.designer.cs file - this answer fixed my error, but including the System.Net makes it easier to code without having to include the full path.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.