Try moving the query-string outside of the
ToAbsolute
call:
VirtualPathUtility.ToAbsolute("~/Products.aspx") + Eval("category", "?category={0}")
The reason this code works on your local machine but not on the server is most likely that it's configured as a .NET 4.0 application locally, but a .NET 2.0 / 3.5 application on the server. As mentioned in
the Community Comments on the version-specific MSDN page[
^], the .NET 2.0 version of this method incorrectly treated
?
as an invalid character.