We've licensed a commercial product (product not important in this context), which is limited by the number of concurrent users. Users access this product by going through a Spring Controller.
We have N licenses for this product, and if N+1 users access it, they get a nasty error message about needing to buy more licenses. I want to m...
I have a controller action which I would like to call another controller action.
Is this a valid thing to do. Is it possible?
...
Hello Everyone,
I've been struggling for some time now with exactly how to recode a page-based php application I have to an MVC framework. (Just for background, I am having to move the app into MVC because my boss is making me :) Anyway, I've sat down and printed out the directory structure and started trying to plan how I can convert...
Hi folks
As described in this post, I created an abstract base controller class in order to be able to pass data from a controller to master.page. In this case, I want to lookup a user in my db, querying for User.Identity.Name (only if he is logged in).
However, I noticed that in this abstract base class the User property is always nul...
Hello Folks,
I was asking a related question but messed the title up and no-one would understand it. Since I am able now to ask the question more precisely, I decided to reformulate it in a new question and close the old one. Sorry for that.
So what I want to do is passing data (my custom user's nickname as stored in the db) to the Log...
Once a controller object is created when does it become available for garbage collection?
...
Im curious to see if you can overload controller methods in ASP.Net MVC. Whenever I try, I get the error below. The two methods accept different arguements. Is this something that cannot be done?
The current request for action 'MyMethod' on controller type 'MyController' is ambiguous between the following action methods:
...
I have a .NET MVC winform app. I've created an AppDelegate class that handles application startup and shutdown...for now (it might do more later). Winform apps have a Program.cs file that does some app initialization, starts the message pump and creates the first form. In my app, the first form is AppDelegate, which isn't really a fo...
I have this showing up all over in my controllers:
if not session[:admin]
flash[:notice] = "You don't have the rights to do #{:action}."
redirect_to :action=>:index
return
end
And its sibling:
if not session[:user] and not session[:admin]
flash[:notice] = "You don't have the rights to do #{:action}."
redirect_to :action=>:i...
I just read a [blog post][1] that explains MVC with a banking analogy. I have a few months of experience with web application development with an MVC framework (CakePHP), so I get the basics, but I began to see a theme that made me think I'm taking a flawed approach to where I put my logic:
Fat models, skinny controllers
Keep as much b...
I am creating a directory of sorts with members and their profiles. I'm using the MVC framework in .net.
I have a view that allows you to find members based on some criteria so my controller has a Find() action result, then another that accepts the post verb. So, somesite.com/members/find displays the search tools, then once the form...
I've got some logic in a controller that sets a status of an object if certain conditions are met:
if params[:concept][:consulted_legal] == 0 && params[:concept][:consulted_marketing] == 1
@concept.attributes = {:status => 'Awaiting Compliance Approval'}
elsif params[:concept][:consulted_marketing] == 0 && params[:concept][:consulted_...
I asked a question earlier which elicited some great responses.
Here's the earlier question
On the back of some advice given there, I've tried moving the following controller logic
if params[:concept][:consulted_legal] == 0 && params[:concept][:consulted_marketing] == 1
@concept.attributes = {:status => 'Awaiting Compliance Approva...
This is the controller
class JavaMailerController {
JavaMailerService javamailerservice
def x = {javamailerservice.serviceMethod()} }
This is the Service
import javax.mail.; import
javax.mail.internet.; import
java.util.*;
class JavaMailerService {
boolean transactional = false
def serviceMethod() { String d_ema...
OK, as is often the case, I have a controller action in my app that is protected from unauthorized access by a before_filter. The only thing is that I need to redirect this action if another condition is true:
class Payment < ApplicationController
before_filter login_required
def new
redirect_to some_other_path if @order.is_fre...
I'm writing a small webapp in Grails and I have the following question regarding best practices for controller design and using GORM:
I'm storing the user object in session.user. Currently all my action methods start with the following code to make sure a valid user is logged in and that the user object is fresh:
class FooController {
...
I'm working on a basic Issue Management System in order to learn ASP.NET MVC. I've gotten it up and running to a fairly decent level but I've run into a problem.
I have a controller named Issue with a view called Open. /Issue/Open lists all of the open issues currently logged on the system. I've defined a route like so:
routes.MapR...
I am in one action on Rails, but I wish to continue processing from within another action. My code looks like this:
send(new_action) #call the new_action method
action_name = new_action #change the controller.action_name
render :action => new_action #inform the view that we're in new_action
this works, b...
I'm writing a small webapp in Grails, and to make sure all users are authenticated I'm using the following filter:
class LoginFilters {
static filters = {
loginCheck(controller:'*', action:'*') {
before = {
if (session.user_id) {
request.user = User.get(session.user_id)
} else if (!actionName.equals...
I'm wring a unit test for a controller and here is my code.
public void DocumentController_IndexMethod_ShouldReturn_Documents()
{
DocumentsController c = new DocumentsController(_repository);
ViewResult result = (ViewResult)c.Index("1");
DocumentsController.DocumentsData data = (DocumentsController.Document...