How to get a querystring with a web service?

B

Bruce W..1

My web service needs a value from the request querystring. So I do a
string topic = Request.QueryString["topic"];

But Visual Studio says "The type or namespace name 'Request' could not
be found (are you missing a using directive or an assembly reference?)"

I tried using some more libraries but no luck. Does a web service have
a hypertext context?

How can I grab the querystring?

Thanks for your help.
 
B

Bruce W..1

Bruce W..1 said:
My web service needs a value from the request querystring. So I do a
string topic = Request.QueryString["topic"];

But Visual Studio says "The type or namespace name 'Request' could not
be found (are you missing a using directive or an assembly reference?)"

I tried using some more libraries but no luck. Does a web service have
a hypertext context?

How can I grab the querystring?

Thanks for your help.

==================================================================

I should add that I'm trying to get the querystring from the URL to the
..asmx file.
 
S

Saurabh Nandu

Hi,

You don't use the QueryString in Web Services. Even though Web Services
appear similar to ASP.NET pages, thats not the way they work.

If there is a parameter for your Web Method, then the Web Service
infrastructure will pass it directly to you in your web method. You don't
need to explictly call it

Eg:
[WebMethod]
public void GetTitle(string Topic)
{
// work with the topic string
}

Regards,
Saurabh Nandu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top