I am trying to familiarize myself with the MVC environment. I would like to add a side menu on my default master page. I however need to add an inherit to get my data. Can I do that or I do I have to keep the 'Inherits="System.Web.Mvc.ViewMasterPage"'?
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<body>
<div...
I have an authentication filter that I want to put on all my actions in a given controller.
Is it possible to add a filter at the controller level?
...
I've been trying to figure out why my views are returning 404 in my staging environment, but not my development environment.
Windows Server 2008 R2
IIS 7.5
MVC 2 Beta definitely installed.
The first Route entry in my Global.asax is as follows:
routes.MapRoute(
"FindStore",
"FindStore",
new...
When a anonymous user tries to access a page that requires authentication, I redirect to the login controller/action:
/user/login?ReturnUrl=/blah/do
Upon logging in, I do:
FormsAuthentication.RedirectFromLoginPage(user.Id.ToString(), false);
The debugger shows that this line does get called.
But then I get redirected to default.as...
How do I find the Route Name that is being used when inside of the ControllerBase using it?
For example, I have a route like this:
routes.MapRoute("Search", "{controller}.mvc/{action}/{criterion}", new { controller = "", action = "", criterion = "" });
...and in my ControllerBase I need the Object.Property that contains "Search" or t...
Will I get the advantage of the new Strongly Typed Html Helpers with asp.net MVC 2 if were to use the spark engine for rendering?
...
I am calling a static method within my business logic layer that, for purposes I won't mention here, needs to do the redirecting itself rather returning information back to the controller to do the redirect.
I figure I need to use the HttpContext object but am struggling with creating the route. I can't simply do context.Response.Redir...
My skills are failing me, and I know I've seen the code around for this but I can't find it.
What's the quickest way to take any arbitrary URL, run it through your asp.net mvc routing system, and come out with a reference to a controller instance on the other end?
For example, code execution is inside some arbitrary controller method. ...
Say there's HomeController with an Details-action. return View() will send data to the Detals.aspx in the Home folder. But who makes that binding? and what if I want it to go to Edit.aspx instead?
Background:
Alot of the code in Details.aspx and Edit.aspx is identical, save for one textbox. Maybe by MVC rigor, the view is not supposed t...
I'm trying to parse data from a page of JSON in my ASP.NET MVC 1.0 web application. I need this data to display in a table on page load and I'm having a great deal of trouble mainly because I've never used JSON before. The JQuery site gives pretty terrible examples as well. This is what I have so far, I need help writing a function:
...
I need to globally redirect my users if a custom error is thrown in my application. I have tried putting some logic into my global.asax file to search for my custom error and if it's thrown, perform a redirect, but my application never hits my global.asax method. It keeps giving me an error that says my exception was unhandled by user ...
Hello, I have an Ajax form that lets me dynamically remove rows from a table using the OnComplete AjaxOption. That works great.
The problem is that even if I hit "Cancel" on the confirm dialog, it still executes the OnComplete javascript. So the form doesn't post, but it looks like it did to the user (the row is removed from the table)....
In a ASP.NET MVC along with a test case project,
How does someone create a test case to test against existing security exploits on a controller method?
For example, how do you create a test case for a call that need anti-forgery token? Or XSS?
...
Is there a way to replace the following code with some JQuery code that use unobtrusive javascript instead of what the MicrosoftAjax library does ?
<ul class="vote">
<li>
<%= Ajax.ActionLink("Up", "UpVote", new { VoteId = item.Id }, new AjaxOptions() { OnSuccess = "upVote(this)" }, null) %>
</li>
</ul>
...
What do I use to set the dataValueField of the Select List when I'm using a List. I want to be able to set the value of the option in the select. If i have:
List list = new List();
list.Add("apple");
list.Add("orange");
and I want my html to be:
apple
orange
...
I have existing ASP.NET MVC View pages and View user controls which I currently use in normal straightforward ASP.NET MVC fashion, sometimes I use RenderPartialView or RenderAction, etc.
By themselves they include tag. I would like to dynamically load either Views or ViewUserControl based on the selection in a dropdown list.
I'm havin...
I am trying to formulate a work-around for the lack of a "checkbox group" in ASP.NET MVC. The typical way to implement this is to have check boxes of the same name, each with the value it represents.
<input type="checkbox" name="n" value=1 />
<input type="checkbox" name="n" value=2 />
<input type="checkbox" name="n" value=3 />
When s...
I have found plenty of icons online, but have yet to find images for other types of controls except 1-off examples. For example - buttons, tabs, dropdown menus, sliders, table headers, panel headers, etc. I've found plenty of tutorials, but our attempts always look bad in comparison (particularly for buttons and tabs).
Are there any f...
I'm building a new ASP.NET MVC application (in C#) and one of the requirements is to create a new database of members. For this, we'd need roles to manage the different types of members and profiles to manage the additional metadata attached to each member. So far so good, just use the standard MembershipProvider, RoleProvider and Profil...
I have a mixed MVC and Web Forms environment that works just fine in VS2008 when I debug. However when I deploy the code to my staging environment I have issues.
Basically I'm using an old school URL Rewrite module for the old Web Forms app, so I have to run the App Pool in Classic Mode for the old URL Rewriter to work. However, when I ...