Showing posts with label querystring. Show all posts
Showing posts with label querystring. Show all posts

Saturday, March 31, 2012

trim querystring

Is there a way to request the whole querystring after the "?"

I want to pull every name value pair out of the querystring in one string.

Thanks!

mike123You may try "Request.QueryString".
No luck

Anything else ?

Thanks!
mike123
I think Request.ServerVariables("QUERY_STRING") will return what you are after?

Simon

Thursday, March 22, 2012

Trouble with QueryString

Hi,
I access a particular page by specifying the page's name and extension like
so:
http://localhost:xxxx/MyFiles/Lucky/
The Lucky directory contains a webpage named Default.aspx. I can access is
without needing to type in the page's name and
extension. This page uses a querystring and is only specified when needed (
e.g. keywords=sam). My trouble is that if I
access the page without specifying the page's name and extension, somehow th
e querystring is given a value on its own.
Debugging reveals that the querystring contains the value of "default.aspx"
What could be causing this issue? I've been at this for a few hours now wit
h no luck. Any help would be greatly appreciated.
Thanks,
RoshawnRoshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Roshawn" <radawson218@.yahoo.com> wrote in message
news:%2374iTQNRHHA.2124@.TK2MSFTNGP06.phx.gbl...
> Hi,
> I access a particular page by specifying the page's name and extension
> like so:
> http://localhost:xxxx/MyFiles/Lucky/
> The Lucky directory contains a webpage named Default.aspx. I can access
> is without needing to type in the page's name and extension. This page
> uses a querystring and is only specified when needed (e.g. keywords=sam).
> My trouble is that if I access the page without specifying the page's name
> and extension, somehow the querystring is given a value on its own.
> Debugging reveals that the querystring contains the value of
> "default.aspx"
> What could be causing this issue? I've been at this for a few hours now
> with no luck. Any help would be greatly appreciated.
> Thanks,
> Roshawn
Hmm, you're absolutely right!
I am doing URL rewriting, using Regex of course. I discovered that one of m
y Regex rules was incorrect. That's what was
causing the trouble as I wasn't filtering out the default page.
Thanks for the help, :-)
Roshawn
Mark Fitzpatrick wrote:
> Roshawn,
> Are you doing any URL rewriting or redirection? I've seen this
> before when doing redirection and not filtering out the default page as a
> possible value.
>

Trouble with QueryString

Hi,

I access a particular page by specifying the page's name and extension like so:

http://localhost:xxxx/MyFiles/Lucky/
The Lucky directory contains a webpage named Default.aspx. I can access is without needing to type in the page's name and
extension. This page uses a querystring and is only specified when needed (e.g. keywords=sam). My trouble is that if I
access the page without specifying the page's name and extension, somehow the querystring is given a value on its own.
Debugging reveals that the querystring contains the value of "default.aspx"

What could be causing this issue? I've been at this for a few hours now with no luck. Any help would be greatly appreciated.

Thanks,
RoshawnRoshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Roshawn" <radawson218@.yahoo.comwrote in message
news:%2374iTQNRHHA.2124@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi,
>
I access a particular page by specifying the page's name and extension
like so:
>
http://localhost:xxxx/MyFiles/Lucky/
>
The Lucky directory contains a webpage named Default.aspx. I can access
is without needing to type in the page's name and extension. This page
uses a querystring and is only specified when needed (e.g. keywords=sam).
My trouble is that if I access the page without specifying the page's name
and extension, somehow the querystring is given a value on its own.
Debugging reveals that the querystring contains the value of
"default.aspx"
>
What could be causing this issue? I've been at this for a few hours now
with no luck. Any help would be greatly appreciated.
>
Thanks,
Roshawn


Hmm, you're absolutely right!

I am doing URL rewriting, using Regex of course. I discovered that one of my Regex rules was incorrect. That's what was
causing the trouble as I wasn't filtering out the default page.

Thanks for the help, :-)
Roshawn

Mark Fitzpatrick wrote:

Quote:

Originally Posted by

Roshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.
>

Trouble with sequence of page build.

Instead of using Hyperlinks and URL / Response.QueryString() parameters to
pass state around in my app, I am using LinkButtons with a corresponding
command event and command arguments.
This page has LinkButtons in a menu down the left hand side, that when
clicked causes the main content of the page to change. The main content of
the page has linkbuttons as well. I am having trouble with the linkbuttons
in the maincontent area keeping their associated command event wired
together.
The linkbuttons in the left menu get built in the page load of the initial
load and all subsequent postbacks (these work fine).
When a left menu linkbutton is clicked it causes a postback,
Page_Load()
BuildLeftMenu() is run in page_load
I don't run BuildMainContent() in the page_load because I don't have the new
TopicID yet.
MyLinkButton_Command() fires next, where I capture the command argument
which tells me the TopicID which I set as a session var and then call
BuildMainContent()
BuildMainContent() fires which grabs the TopicID from the Session and builds
the maincontent linkbuttons .
The server returns the page to me and the maincontent linkbuttons exist, but
are not wired to their commandevents. Meaning when I click on them nothing
happens.
****************************************
***********
Now if I put the BuildMainContent() in the page_load so it builds in the
postback, everything works okay.
My question is, why aren't the commandevents wired to the linkbuttons, when
I have clearly wired them up in the BuildMainContent() method?
Thanks.
TPS.Hi TPS,
As for the postback issue on the dynamic controls you mentioned, here are
my understandings:
The Controls added in the "BuildMainContent()" method is called in other
controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?
That means the maincontent's Linkbutton's postback event handler are wireup
when page processing the postback event rather than before it. So of course
it can 't be fired. And when you move the BuildMainContent() to Page_Load,
their events will be fired.
In fact, as for dynamically created controls, the following two things
should be noticed:
1.Dynamic control should be created everytime page is requested (both the
intial load and the sequential ...). We recommand that we create and add
them in page's OnInit .(in Page_Load is also ok)
2. If the control need to register postback event handler, the handler
should be wireup before the page processing the postback event.
Generally in Page's Init or Load event.
And here is good tech article which has mentioned the things above. I
believe it'll help on undertanding them:
#Understanding ASP.NET View State
http://msdn.microsoft.com/library/d...-us/dnaspp/html
/viewstate.asp
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven, thanks for your reply.
I have read for hours and still can't seem to answer my question.
My problem is my LinkButton event handler fires "AFTER" the page has been
built. When the event handler fires, that is where I am getting "TopicID"
from the command arguement. I am using the new TopicID to populate my
LinkButtons, but it is too late because the page has already been built!
Ideas?
Thanks,
TPS
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:hzkuTgreEHA.720@.cpmsftngxa06.phx.gbl...
> Hi TPS,
> As for the postback issue on the dynamic controls you mentioned, here are
> my understandings:
> The Controls added in the "BuildMainContent()" method is called in other
> controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?
> That means the maincontent's Linkbutton's postback event handler are
wireup
> when page processing the postback event rather than before it. So of
course
> it can 't be fired. And when you move the BuildMainContent() to Page_Load,
> their events will be fired.
> In fact, as for dynamically created controls, the following two things
> should be noticed:
> 1.Dynamic control should be created everytime page is requested (both the
> intial load and the sequential ...). We recommand that we create and add
> them in page's OnInit .(in Page_Load is also ok)
> 2. If the control need to register postback event handler, the handler
> should be wireup before the page processing the postback event.
> Generally in Page's Init or Load event.
> And here is good tech article which has mentioned the things above. I
> believe it'll help on undertanding them:
> #Understanding ASP.NET View State
>
http://msdn.microsoft.com/library/d...-us/dnaspp/html
> /viewstate.asp
>
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
Hi TPS,
I've seen for new post discussing on the same problem in this group named
"Can EventHandler fire in Page_PreRender event".
I've posted my reply in the thread. I'd appreciate if you have a look
there.
In addition, if you feel it convenient that we continue to discussing in
one of the two threads, please feel free to followup in either one. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Trouble with sequence of page build.

Instead of using Hyperlinks and URL / Response.QueryString() parameters to
pass state around in my app, I am using LinkButtons with a corresponding
command event and command arguments.

This page has LinkButtons in a menu down the left hand side, that when
clicked causes the main content of the page to change. The main content of
the page has linkbuttons as well. I am having trouble with the linkbuttons
in the maincontent area keeping their associated command event wired
together.

The linkbuttons in the left menu get built in the page load of the initial
load and all subsequent postbacks (these work fine).

When a left menu linkbutton is clicked it causes a postback,

Page_Load()
BuildLeftMenu() is run in page_load

I don't run BuildMainContent() in the page_load because I don't have the new
TopicID yet.

MyLinkButton_Command() fires next, where I capture the command argument
which tells me the TopicID which I set as a session var and then call
BuildMainContent()

BuildMainContent() fires which grabs the TopicID from the Session and builds
the maincontent linkbuttons .

The server returns the page to me and the maincontent linkbuttons exist, but
are not wired to their commandevents. Meaning when I click on them nothing
happens.

************************************************** *

Now if I put the BuildMainContent() in the page_load so it builds in the
postback, everything works okay.

My question is, why aren't the commandevents wired to the linkbuttons, when
I have clearly wired them up in the BuildMainContent() method?

Thanks.

TPS.Hi TPS,

As for the postback issue on the dynamic controls you mentioned, here are
my understandings:

The Controls added in the "BuildMainContent()" method is called in other
controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?

That means the maincontent's Linkbutton's postback event handler are wireup
when page processing the postback event rather than before it. So of course
it can 't be fired. And when you move the BuildMainContent() to Page_Load,
their events will be fired.

In fact, as for dynamically created controls, the following two things
should be noticed:
1.Dynamic control should be created everytime page is requested (both the
intial load and the sequential ...). We recommand that we create and add
them in page's OnInit .(in Page_Load is also ok)

2. If the control need to register postback event handler, the handler
should be wireup before the page processing the postback event.
Generally in Page's Init or Load event.

And here is good tech article which has mentioned the things above. I
believe it'll help on undertanding them:

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/d...-us/dnaspp/html
/viewstate.asp

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven, thanks for your reply.

I have read for hours and still can't seem to answer my question.

My problem is my LinkButton event handler fires "AFTER" the page has been
built. When the event handler fires, that is where I am getting "TopicID"
from the command arguement. I am using the new TopicID to populate my
LinkButtons, but it is too late because the page has already been built!

Ideas?

Thanks,
TPS

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:hzkuTgreEHA.720@.cpmsftngxa06.phx.gbl...
> Hi TPS,
> As for the postback issue on the dynamic controls you mentioned, here are
> my understandings:
> The Controls added in the "BuildMainContent()" method is called in other
> controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?
> That means the maincontent's Linkbutton's postback event handler are
wireup
> when page processing the postback event rather than before it. So of
course
> it can 't be fired. And when you move the BuildMainContent() to Page_Load,
> their events will be fired.
> In fact, as for dynamically created controls, the following two things
> should be noticed:
> 1.Dynamic control should be created everytime page is requested (both the
> intial load and the sequential ...). We recommand that we create and add
> them in page's OnInit .(in Page_Load is also ok)
> 2. If the control need to register postback event handler, the handler
> should be wireup before the page processing the postback event.
> Generally in Page's Init or Load event.
> And here is good tech article which has mentioned the things above. I
> believe it'll help on undertanding them:
> #Understanding ASP.NET View State
http://msdn.microsoft.com/library/d...-us/dnaspp/html
> /viewstate.asp
>
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi TPS,

I've seen for new post discussing on the same problem in this group named
"Can EventHandler fire in Page_PreRender event".

I've posted my reply in the thread. I'd appreciate if you have a look
there.
In addition, if you feel it convenient that we continue to discussing in
one of the two threads, please feel free to followup in either one. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx