简体   繁体   中英

Receiving post from flash in MVC 2

I hope you can help me with this one.

I have a flash-movie on my webpage, which makes a post when its done playing. I want to catch that post and update a session.

I get the following "post-error" when the movie ends.

POST /en/RunTest/test/showmovie/finish
HTTP/1.1 500 Internal Server Error

"test" is my controller
"showmovie" is my action which takes an id as parameter. fx.

/en/runtest/test/showmovie/1

That is the page my flash is on.

I've tried the using the HandleUnknownAction-method, but it just never gets there. I've tried some MapRoute'ing - but havent succeded.

What i want is the method setMovieSeen to be called whenever i recieve the post from the flash.

Thanks!

you could explicitly handle the route that it's posting to, but creating a route in your global.asax.cs file and then handling the post in the action on the controller that you post to. I'm not sure what parameters it's posting, I would assume you would be able to get the movie id from it's post vars.

routes.MapRoute(
    "Movie_Finish",                                     
    "en/RunTest/test/showmovie/finish",                 
    new { controller = "Test", action = "MovieFinish" } 
);

Then your action could be:

public ActionResult MovieFinish() {
  // get parameters needed from the post variables (use fiddler to watch the POST)
  // update setMovieSeen 
  return View();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM