Search code examples
c#asp.net-mvcrazorsharepoint-apps

MVC Redirect to another page


I have a controller which processes an uploaded file. In that controller, I return the user to a SharePoint list depending on the successful parsing of that file. I am able to enter a direct URL, but I am opening this page in a form so I need to change the window.top.location instead of just window.location. I tried doing this a few ways such as returning a JavaScript result, but I received some browser warning messages I'd like to avoid.

I ended up making a partial razor view which grabs a parameter from the query string in order to determine which list it should go to. The function works fine, but the page is seemingly inactive when I return it using:

return Redirect("~/Parsing/ParsingRedirector?List=MasterDealer");

My page exists in the folder, but I get an error stating "The resource cannot be found. " Any reason why that's happening? I admittedly don't have a full understanding of MVC or even close to it at this point.


Solution

  • Try this:

    return RedirectToAction("ParsingRedirector", "Parsing", new { List = "MasterDealer"});