• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

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

1 Solution
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:

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.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now