MVC :: Child Actions Are Not Allowed To Perform Redirect Actions

Jun 29, 2010

I am getting an exception that child actions are not allowed to perform redirect actions. Although I can understand that this might is true in most situations I do believe that the framework might allow this to pass when a Child Action is calling another child action like in this example:

I have this code in my CountryController (I compacted it a bit but the main concept remains that I have a controller with Child Actions only):

[Code]....

This exception is being thrown:

Server Error in '/' Application.

Child actions are not allowed to perform redirect actions. Description:An unhandled exception occurred during the execution of the current web request. Review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Child actions are not allowed to perform redirect actions.

View 4 Replies


Similar Messages:

Perform Actions/events On A Specific Time?

Feb 9, 2011

I'm trying to built a website which performs actions (for example, perform backup or sends email or process data) on a specific time like every Friday 12 PM. Is there any tricks I can do with ASP.NET using C#?

View 2 Replies

AJAX :: Perform Actions When Clicking On The Dropdownextender?

Jan 5, 2010

I need to perform actions (e.g. hide panels) when clicking on the dropdownextender arrow - before the dropdown panel is being displayed.

How should I perform this? should I use onclientpopulated?

View 5 Replies

MVC :: How To Redirect Actions, That Require Https To A Certain Subdomain

Mar 16, 2011

I am new to asp.net and mvc 3. Currently I am experimenting with https. I use mvc 3, iis 7 and visual studio 2010 under windows 7.

The problem that I want to solve is the following.

The SignUp action should only be accessible via https.

My SSL certificate is issued only for a certain subdomain: secure.mydomain.com

The goal is that all requests to SignUp are redirected to secure.mydomain.com/SignUp such that the certificate fits to the domain.

Requests not using https simply should use mydomain.com.

I successfully installed the certificate to my local iis 7, and when I use the [RequireHttps] attribute, the connection is protected with this certificate.

My questions are:

How can I do the redirects right?

Is there a possibility to test this on my local machine where all request go to localhost?

View 6 Replies

How To Set Properties That Are Available In Actions

Jan 21, 2011

In my actions, I want to pre-load the User object and set some other properties, all BEFORE the action loads. I know there are events where I can do this, but how will these objects that I set be made available in my controller's actions once the filter fires and execution is now at the action level?

example:

public actionresult SomeAction()
{
string username = this.CurrentUser.username;
}

View 1 Replies

MVC :: Distinguish Between Those Actions?

Jun 26, 2010

View on a button I have many different actions. So how to align them with the corresponding action in the controller. Means I want to know how many actions a View.For example, in the registration page.I have a button-Register and Login button. In the controller I have a registration action, an action Login. So how can I distinguish between those actions.

View 1 Replies

.NET MVC Actions With Optional Parameters

Feb 1, 2010

I have an MVC action on my abstract BaseControlller like this (and this action is common across all inheriting controllers):

//
// GET: /controller/RenderForm/{formType}
[Authorize(Roles = "Administrators")]
public ActionResult RenderForm(FormType formType, BaseContentObject contentObject)
[code]...

View 1 Replies

MVC :: How To Pass Data Between Actions

Aug 10, 2010

I am set up a series of pages like so...Page 1: User is presented a series of checkboxes. Each checkbox represents a group.<User makes selection and submits form, Controller validates input and send selected list to next action>Page 2: User is presented a series of checkboxes of items within the groups he/she selected in step 1.<User makes selection and submits form, Controller validates input and send selected list to next action>

View 2 Replies

C# - What's The Best Way To Handle Multiple Actions

Jun 1, 2010

Like most web applications you have a method that gets called when you log in. There are a few things that may need to get done when logged in and over time this may increase. eg. logging, welcome emails, maintenance. Should events be used to do this or is there a better way?? I'm using C# and ASP.net MVC. Update This is already in its on Service Layer class. eg.

public void Login(User user)
{
SetAuthCookie(user);
LogLogin(user, true);
SendEmails();
}

View 3 Replies

MVC :: 3 Moving Between Controler Actions?

Nov 28, 2010

Is there a way to easily passed around an ID between controller actions on the same controller?I.E. I have an Index action which takes an ID parameter, and when a user creates a new post I would like them to go back to the index page with the same ID.Currently I am just passing it around in my view model, but it seems real cumbersome and I was wondering if there was a better way to do this?

View 1 Replies

Point Actions To The Same View?

Feb 3, 2010

I have a controller with the following actions...

public ActionResult YellowList()
public ActionResult RedList()
public ActionResult BlueList()

All these actions populate the same viewModel (ListViewModel).

How do I get them all to point to the same view (aspx)?

View 2 Replies

MVC :: Change Log And Logging Actions?

Aug 19, 2010

I'm trying to create a log that would keep a history of changes for a given item. For example on [HttpPost] Edit page I would log a change for a given article. So i've created a filterAttribute that would execute once the Edit action has completed successfully:

public class LogAttribute : ActionFilterAttribute
{
private int type; [code]...

I tried this:

filterContext.ActionDescriptor.GetParameters()

but this only returns "strings" as a parameter. "objectId" however is stored in a hidden field on the edit page.

View 2 Replies

MVC :: Routes Uniqueness And SEO - Using Id And Name As Parameters In The Actions?

Feb 2, 2010

I am using the Default Route as follows:

routes.MapRouteLower("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" });

However, beacause of SEO I would also like to filter not by id but by name. Something like: Product/Show/RedBall instead of Product/Show/2345 And if RedBall is not unique what would be a good approach to do this? Maybe start using the following: Product/Show/2345/RedBall Using Id and Name as parameters in the actions?

View 2 Replies

Strongly Typed API For MVC 2 Async Actions

May 17, 2010

Have anybody tried to create strongly typed API for ASP.NET MVC 2 async actions?

View 1 Replies

MVC :: Different Actions Having Same Signature If Don't Want To Pass Action Name?

Sep 6, 2010

I am having one controller Test having following actions

(1)public ActionResult ABC (string parameter1, string parameter2)

(2)public ActionResult XYZ (string parameter1, string parameter2,string parameter3, string parameter4)

i have added following html.routelinks

<%= Html.RouteLink("ABC","ABC", new { parameter1 = 100, parameter2 = 200 } )%><br />
<%= Html.RouteLink("XYZ", "XYZ", new { parameter1 = 1000 , parameter2 = 2000 }) %>

last two parameters in XYZ action are optionals so i have not passed them in Html.routelink

routes.MapRoute("ABC", "Test/{parameter1}/{parameter2}", new { controller = "Test", action = "ABC", parameter1= 0,parameter2=0 });

routes.MapRoute("XYZ", "Test/{parameter1}/{parameter2}/{parameter3}/{parameter4}", new { controller = "Test", action = "XYZ", parameter1=0,parameter2=0 ,parameter3=UrlParameter.Optional,parameter4=UrlParameter.Optional});


In above senario in both cases same route "ABC" is called eventhough i have clicked on second Html.routelink. can anyone solve this issue ? how can i route according to route name instead of number of parameters?

View 1 Replies

MVC JSON Actions Returning Boolean?

Sep 20, 2010

I had my ASP.NET MVC actions written like this:

//
// GET: /TaxStatements/CalculateTax/{prettyId}
public ActionResult CalculateTax(int prettyId)
{
if (prettyId == 0)
return Json(true, JsonRequestBehavior.AllowGet);
TaxStatement selected = _repository.Load(prettyId);
return Json(selected.calculateTax, JsonRequestBehavior.AllowGet); // calculateTax is of type bool
}

I had problems with this because when using it in jquery functions I had all sorts of error, mostly toLowerCase() function failing.

So I had to change the actions in a way that they return bool as string (calling ToString() on bool values), so that thay return "true" or "false" (in the qoutes) but I kinda don't like.

How others handle such a case?

View 1 Replies

Asp Don't Load Custom Actions Assembly

Feb 9, 2011

My setup project installs web site and executes some custom actions using a class library. That class library is copied to bin folder of the web site, and after that IIS tries to load it even though it isn't needed by the web site any how. How to prevent the class library from loading? Maybe it is possible to copy it to another directory instead of bin? Or maybe the web.config can be configured in such a way to prevent that class library from loading?

View 1 Replies

Web Forms :: Actions In Page_Load Not Executed?

Jul 7, 2010

I've reated a project containing 15 pages , (inculding one for logging in )well , i've noticed that actions located in the page_load function are not executed! (i've tested with changing the text of a label and a text box) and it's in all pages except the authentification page!i've read tht it's probably due to the DATETIME class used in pages. but is there any other explanation? or is there any way to fix the problem

View 3 Replies

Retain Query String Between Actions?

Jan 5, 2011

My controller has three actions: Inroduction, Index and category. In my master page I have a text box and a search button. The general idea is that the user reaches the Introduction view, then types text into the textbox and clicks the search button. He then sees the Index view, while the query string holds a value by which the data the user sees is filtered. the user can choose a category and then he is redirected to the category view. How can I maintain the query string field and value (let's say "?cities=1,2,3") when I move between the actions Introduction, Index and category ? I'll just point out that the query string value will change if the user enters new text in the textbox.

View 2 Replies

MVC :: Same Time Two Actions In Html.Beginform?

May 25, 2010

[Code]....

so on my view its going to Update Actionresult on button click.. itsdoing fyn.. but is there any way that we can do two action same time on Beginform.. that is Frist it need to go to GetStudentInfo, Home and then Immediatly Update, home?bec to update each and every time I need StudentInfo and then update

View 2 Replies

.net - Interrupt/intercept MVC Actions Using ActionFilters?

Jul 1, 2010

I wish to be able to place a System.Web.ActionFilterAttribute on an Action Method and override the OnActionExecuting method to insert business logic which determines if the Action should be fulfilled. Can the ActionExecutingContext be used to cancel the executing Action Method and do one of the following:

Send an HTTP Status Code (and the corresponding <customError> page).Execute a different Action Method within the same Controller.

View 2 Replies

Javascript - Launch Two Actions In One Button?

Jun 12, 2010

I'm developing a comment page in asp.net, this my page:

<form action="#">
<p><textarea id="textArea" rows="5" cols="30">

View 2 Replies

How To Suppress Click Actions On TreeView With JQuery

Mar 15, 2011

I have the following code:

[Code]....

When running it looks like this: (Image Link) When I click on the Add New link in the Users section I get this: (Image Link) When I click on the ** Move Company** link in the company details section I get this: (Image Link)

Now, everything is working good so far - until I click on a node in the tree within my modal popup. It then exits the popup and I don't want it to. I am not good at JQuery (the JQuery above is not mine) and I tried to suppress the node click events with the commented out code above but all that did was suppress the entire popup from showing!

what I can do to suppress the node clicks from firing the JQuery close routine for the modal popup?

View 2 Replies

MVC :: Master Page Content Based On Actions?

Jul 2, 2010

Been browsing these pages for a while now and finally decided to say hi!I read about having an "Application controller" as mustinherit class for the actual controller to set content for the master page. But what I would like to do is to set some content to Master based on which actions are called on the controller.

For example..
/Backend/A1
... "Help content nr1 to master page"
/Backend/A3
/Backend/B1
... "Help content nr2 to master page"
/Backend/B10

And so forth. Ofcourse I could do this the "easy" way by just adding some clip on each of the actions. But I was wondering if there is a smarter way to do it. To check on the application controller which action is being called and select the "helpcontent" based on that to the Master.

View 1 Replies

How To Pass Data Between Controllers And Overloaded Actions

Mar 13, 2011

I have one controller that takes a username and pass and checks against a database. IF the user is authenticated, I want to call an overloaded action on another controller.

My end goal is to authenticate a user against an old table from a MySQL db (I have this part working). Once the user is authenticated, I would like to be able to "automagically" forward the person to the built in MVC registration page but I would like to populate some fields in the view using data obtained from the first controller (the old databse info).

When I try something like what I have below I get an error about the Register() methods being ambiguous. I've also tried using the [ActionName("Register2")] attribute but then the error returned says it cant find a method named Register2.

[Code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved