Dropdown List Box PostbackURL?

I have a page that has a dropdown listbox that enables users to select which field to sort the display by, using a postback. Problem is that the page goes by many names (i.e. i rewrite the url) so sometimes the page URL is /products/vcr.aspx and sometimes /products/components/speakers.aspx etc. the URL of the actual pages is /products/products.aspx.
When the /products/products.aspx page is displayed a rewritten URL (i.e. /digital-cameras.aspx), the dropdown listbox doesn't postback to /products/products.aspx or /digital-cameras.aspx but to /products.aspx (which doesn't exist) and so returns an error. The ASP button has a PostbackURL property to control where the postback is directed, is there something similar for the dropdown listbox? Any ideas on how to get around this?
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.

David H.H.LeeCommented:
I'm not sure how you rewrite url based on your current problem. Do you write your code in Application_BeginRequest routine under web.config? If can, post some working code here, so all of us can see how to help you solve the problem.
By the way, try to access your root folder start with "~". Seem the url point to wrong folder.
ctudorpriceAuthor Commented:
hi - code is in application_beginrequest. The problem is not with the url rewriting but with the <form action=...> being set to the rewritten URL and thus any postbacks from my dropdown listbox are being directed to the rewritten url, not the physical page URL.
I think I may have found a solution adding a javascript to every page override the form's action.... will let you know.
ctudorpriceAuthor Commented:
Here's what I did to fix this:

Page.ClientScript.RegisterStartupScript(Me.GetType, "PostBackFix", "<script language=""JavaScript"" type=""text/javascript"" >document.forms[0].action='';</script>   ")

this ensures that the postback is sent to the actual page, not the rewritten url.
PAQed with points refunded (500)

Community Support Moderator

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
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

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.