how to use Server.Transfer inside a template - is it possible?


I am using a templateItem's NavigateUrl property to redirect to my landing page passing some variables.

I  would like to hide the querystring from the user similarly to how Server.Transfer does it.

Is there a way to do this from the .aspx page code?

My code is included below.

Thank you much.
NavigateUrl='<%# "AR_Collection_Comments.aspx?InvID=" + 
                                                    DataBinder.Eval(Container.DataItem,"recv_invoice_id") + 
                                                    "&CustID=" + DataBinder.Eval(Container.DataItem,"journal_customer_id") +
                                                    "&InvDate=" + DataBinder.Eval(Container.DataItem,"invoice_date") +
                                                    "&NetDueDate=" + DataBinder.Eval(Container.DataItem,"net_due_date") +
                                                    "&Entity=" + DataBinder.Eval(Container.DataItem,"entity_id") %>'

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

käµfm³d 👽Commented:
Server.Transfer doesn't technically hide a query string. When a user requests page A, if page A uses Server.Transfer(pageB), then page B is sent back on the same request. The request never changed; only what was served did. For intents and purposes, yes, it does appear to hide a query string.

To hide a query string for things like SEO, you might consider looking into URL Rewriting. For more information:


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.