views:

40

answers:

0

How do I build a querystring for javascript with several parameters that I can pass along when calling an action method in MVC 2? This is what I tried:

var queryString = "?fileName=" + file + "&filePath=" + filePath;
document.location.href = '/Customers/Download/' + queryString;

Action method signature:

public ActionResult Download(string filePath, string fileName)
        { (etc...}

It worked fine before when I only had one parameter, and I guess it has something to do with the ampersand. I tried escaping it as in C# with a backslash, but that didn't work. What am I doing wrong? And/or is there another way to do this?