By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,214 Members | 2,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,214 IT Pros & Developers. It's quick & easy.

Request Object

P: n/a
I am trying to access in Javascript within an ASP.NET web page the Request
Object. I am specifically trying to access the values in the
Request.QueryString. When I try to access the values I get an error
specifying that the Request object is undefined... The Jscript code is as
follows:

alert(Request.QueryString("CASE")[1]);

In any thoughts or am Is my syntax incorrect. I need to be able to access
the QueryString from within jscript...

Thanks in advance

Nov 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"=?Utf-8?B?QW5nZWw=?=" <An***@discussions.microsoft.com> wrote in
news:7A**********************************@microsof t.com:
alert(Request.QueryString("CASE")[1]);

In any thoughts or am Is my syntax incorrect. I need to be able to
access the QueryString from within jscript...


In basic javascript ... there is no request object. You need to parse the
query string yourself.

But maybe Microsoft's Jscript has an extension?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #2

P: n/a
How do you get that information otherwise then using the Request Object? So
there is another way besides using the Request Object? If there is does
anyone know how? I would greatly appreciate it.

thanks

"Lucas Tam" wrote:
"=?Utf-8?B?QW5nZWw=?=" <An***@discussions.microsoft.com> wrote in
news:7A**********************************@microsof t.com:
alert(Request.QueryString("CASE")[1]);

In any thoughts or am Is my syntax incorrect. I need to be able to
access the QueryString from within jscript...


In basic javascript ... there is no request object. You need to parse the
query string yourself.

But maybe Microsoft's Jscript has an extension?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com

Nov 19 '05 #3

P: n/a
JavaScript is on the client side. The client sends an HTTP Request to the
server. The server side classes can see the Request. They send a Response to
the client as a Web Page. So, JavaScript is client-side, and ASP.Net is
server-side, and never the twain shall meet. All they can do is send
messages back and forth, via Request and Response.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Angel" <An***@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
How do you get that information otherwise then using the Request Object?
So
there is another way besides using the Request Object? If there is does
anyone know how? I would greatly appreciate it.

thanks

"Lucas Tam" wrote:
"=?Utf-8?B?QW5nZWw=?=" <An***@discussions.microsoft.com> wrote in
news:7A**********************************@microsof t.com:
> alert(Request.QueryString("CASE")[1]);
>
> In any thoughts or am Is my syntax incorrect. I need to be able to
> access the QueryString from within jscript...


In basic javascript ... there is no request object. You need to parse the
query string yourself.

But maybe Microsoft's Jscript has an extension?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com

Nov 19 '05 #4

P: n/a
Kevin Spencer wrote:
JavaScript is on the client side. The client sends an HTTP Request to
the server. The server side classes can see the Request. They send a
Response to the client as a Web Page. So, JavaScript is client-side,
and ASP.Net is server-side, and never the twain shall meet. All they
can do is send messages back and forth, via Request and Response.


Although you could look into AJAX or XMLHttp to get the data.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #5

P: n/a
We can populate JavaScript variables using QueryString values on the server.
One example of how is shown by this VB example [1] at the very bottom of the
page.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://aspnet.4guysfromrolla.com/art...30202-1.2.aspx


"Angel" <An***@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
How do you get that information otherwise then using the Request Object?
So
there is another way besides using the Request Object? If there is does
anyone know how? I would greatly appreciate it.

thanks

"Lucas Tam" wrote:
"=?Utf-8?B?QW5nZWw=?=" <An***@discussions.microsoft.com> wrote in
news:7A**********************************@microsof t.com:
> alert(Request.QueryString("CASE")[1]);
>
> In any thoughts or am Is my syntax incorrect. I need to be able to
> access the QueryString from within jscript...


In basic javascript ... there is no request object. You need to parse the
query string yourself.

But maybe Microsoft's Jscript has an extension?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com

Nov 19 '05 #6

P: n/a
clintonG wrote:
We can populate JavaScript variables using QueryString values on the
server. One example of how is shown by this VB example [1] at the
very bottom of the page.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://aspnet.4guysfromrolla.com/art...30202-1.2.aspx


That code obviously requires a postback. I think the original poster was
asking about how to avoid the postback.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #7

P: n/a
"JIMCO Software" <co*******@jimcosoftware.com> wrote in
news:OW**************@TK2MSFTNGP10.phx.gbl:
Kevin Spencer wrote:
JavaScript is on the client side. The client sends an HTTP Request to
the server. The server side classes can see the Request. They send a
Response to the client as a Web Page. So, JavaScript is client-side,
and ASP.Net is server-side, and never the twain shall meet. All they
can do is send messages back and forth, via Request and Response.


Although you could look into AJAX or XMLHttp to get the data.


You can use this javascript function to parse the query string:

function getParameter(queryString, parameterName)
{
// Add "=" to the parameter name (i.e. parameterName=value)
var parameterName = parameterName + "=";
if ( queryString.length > 0 )
{
// Find the beginning of the string
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise
return the value
if ( begin != -1 )
{
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 )
{
end = queryString.length
}
// Return the string
return unescape ( queryString.substring ( begin, end ) );
}
// Return "null" if no parameter has been found
return "null";
}
}

ScriptID = getParameter(window.top.location.search, "ScriptID");
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #8

P: n/a
Why don't you look at the topic "2.0 beta 2: Disappearing Controls" to
determine if you can help me debug the problem I've described?

<%= Clinton Gallagher

"JIMCO Software" <co*******@jimcosoftware.com> wrote in message
news:uS****************@TK2MSFTNGP15.phx.gbl...
clintonG wrote:
We can populate JavaScript variables using QueryString values on the
server. One example of how is shown by this VB example [1] at the
very bottom of the page.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://aspnet.4guysfromrolla.com/art...30202-1.2.aspx


That code obviously requires a postback. I think the original poster was
asking about how to avoid the postback.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003

Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.