controller

HTML5 audio control stop button (as opposed to pause)

拟墨画扇 提交于 2019-12-05 11:20:56
I've been absolutely everywhere (I think) and can't seem to find a way to call a stop event in an html5 audio controller. My audio controller has a playlist where each track will play when selected or cycle through each track to the next. There's also a next button which works. My play/pause button looks like this: ` function playPause() { var audioPlayer = document.getElementsByTagName('audio')[0]; if(audioPlayer!=undefined) { if (audioPlayer.paused) { audioPlayer.play(); } else { audioPlayer.pause(); } } else { loadPlayer(); } } ` I need a "Stop" button that stops the audio and goes back to

In MVC3, how to get the current controller name?

柔情痞子 提交于 2019-12-05 10:13:05
From the http context class is there a method to get the current Controller name? Yes, you can do something like that HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString(); If you're in a view, then you can do: ViewContext.RouteData.Values["Controller"] 来源: https://stackoverflow.com/questions/14462751/in-mvc3-how-to-get-the-current-controller-name

Using Postal Library From the Business Layer

做~自己de王妃 提交于 2019-12-05 10:12:56
I have a website built using ASP.NET MVC3 which is layered as follows: ProjectName.Shared (model + service contracts) ProjectName.Infrastructure ProjectName.Data ProjectName.Data.Sql ProjectName.Managers (Business layer) ProjectName.Services (WCF services) ProjectName.UI.Main (ASP.NET MVC3 application) This is actually the structure I recently came up with after some refactoring. Unfortunately, there isn't complete separation between the UI and my business layer so this area could use some more refactoring - which I cannot do right now because I'm on a tight deadline. As for now, my client has

ASP.NET MVC - Where do you put your .js files if you dont want to store them in /Scripts?

纵饮孤独 提交于 2019-12-05 09:51:09
I have a number of .js files that I would like to be stored in the same directories as their views (they're specific to a view - its simply to keep the javascript separate from the view's HTML) However, adding them to the /Views/ControllerName/ directory wont work because when a request is made to the webserver for the .js file: <script type="text/javascript" src="/Views/ControllerName/myscript.js"></script> It would essentially be directed at the 'Views' controller which obviously doesnt exist. Update From what I have read, adding the following IgnoreRoute in the global.asax.cs RegisterRoutes

Is the controller name derived from the class name?

戏子无情 提交于 2019-12-05 09:48:25
This is a newbie question... I am looking at the default asp.net mvc3 project and noticed that there is a controller called: public class AccountController : Controller I looked throughout the code and couldn't find a place that specified AccountController maps to /Account/ for the URL. I discovered that you can change the routing using routes.MapRoute(..) in the Global.asax , but I still don't know where they specified that AccountController maps to /Account/. If it is assumed from the class name, then does that mean all controller classes have to be named xxxxxController? Yes you are right,

Can't call indexController's actions other than indexAction in Phalcon php

你离开我真会死。 提交于 2019-12-05 09:34:58
I have a simple project in my xampp/htdocs directory called phalcon and I have apache configured to point to that folder so that I can go to phalcon/ in my browser. The problem occurs when I try to open an index controller view other than index(default). For instance I have someAction in Index controller and in views/index I have some.phtml. If I go to phalcon/index/some I don't get the text from some.phtml outputed to the page. It's probably because it thinks as if I wan't to open IndexController->indexAction and pass some as a parameter. Would be grateful on any help provided to resolve this

MVC Api Action & System.Web.Http.AuthorizeAttribute - How to get post parameters?

情到浓时终转凉″ 提交于 2019-12-05 09:13:19
I have the following API Controller: public class TestController : ApiController { [HttpPost] [APIAuthorizeAttribute] public IQueryable<Computers> ListOfComputersInFolder(Guid folderId) { return GetListOfComputersForFolder(folderId); } // End of ListOfComputersInFolder } // End of TestController And the following is my basic APIAuthorizeAttribute . public class APIAuthorizeAttribute : System.Web.Http.AuthorizeAttribute { public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext) { var Request = System.Web.HttpContext.Current.Request; var folderId =

@RestController without @ResponseBody on methods work incorrect

◇◆丶佛笑我妖孽 提交于 2019-12-05 08:27:02
I have the following controller: @RestController @RequestMapping(value = "/base/url") public class MyController { @RequestMapping( value = "/child/url", method = RequestMethod.POST ) @ResponseBody public String mmm() { return "Ok"; } } Now its working(server response Ok ) but I thought that @ResponseBody redundant because we use @RestController and removed @ResponseBody annotation and I see following server response: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 404 Not Found</title> </head> <body> <h2>HTTP ERROR 404</h2> <p>Problem

Cakephp: Abstracting AppController another level, possible?

こ雲淡風輕ζ 提交于 2019-12-05 08:04:21
I was wondering if it's somehow possible to add another abstraction controller between AppController and my app's other controllers? So that my controllers, e.g. UsersController extends SecureController and SecureController extends AppController. Also I want to be able to have other controllers extend AppController directly: SomeNonSecureController extends AppController. this is because my current AppController has all sorts of Auth and ACL stuff in its beforeFilter, but i also have controllers that don't need that security stuff (before everything needed the security, no new specs have been

@ControllerAdvice exception handler method not get called

人盡茶涼 提交于 2019-12-05 08:03:58
I am working on sample demo application for Exception Handling in Spring MVC.I am trying Exception Handling With @ControllerAdvice I followed steps as describe in this link. But when i run my application i get the following error org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.test.core.ApplicationException For more details following are the classes I am working on ApplicationException.java public class ApplicationException extends RuntimeException{ /** * */ private static final long serialVersionUID = -9061684361606685158L; private