By default, the MVC Authorize attribute sets the HttpContext.Response.StatusCode = 401 when a user is not authorized and the section in the web.config routes to the loginUrl property.
I want to do something similar with other response codes. For example, I have an attribute called ActiveAccount which verifies the user's account is cur...
Why is this
<%=Html.ActionLink("Users", "Index", "Users", new { id = "3" })%>
Pointing to this
http://localhost:1798/Users/Index?Length=8
Instead of this
http://localhost:1798/Users/Index/3
Registered Routes Method:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*path...
I'm using custom controllers that cache static resources (CSS, JS, etc.) and images. I'm currently working with a hosting provider that has set me up under a full trust profile. Despite being in full trust, my controllers fail because the caching strategy relies on the File class to directly open a resource file prior to treatment and st...
Hi I have the following view that gets the values for the form fields from a viewdata that contains an instance of a class ApplicationSettingEntity. the ApplicationSettingEntity class contains an instance of a machineentity class as one of the attributes. The form is populated by values from
item.Id
item.Key
item.Machine.Name
When I ...
I would like to mimic the RepeatColumn function of the ASP.NET DataList control in ASP.NET MVC. The goal is to have 2 or more rows of a collection in one table row.
The following code works, but it looks very ugly to me. Is there better way to do it? Thanks for any help!
<table>
<%
for (int i = 0; i < items.Count(); i++)
...
My categories can be nested about 6 levels deep at most. The problem I am having is getting the breadcrumb array or list from the database (sql server 2005). My sql skills are not that great. Once I get the breadcrumb from the database what would be the best way to present it.
...
I have a question regarding keeping the controller and view separate. It seems to me that the controller should only pass a model to the view, and the view decides how to display the model. This way, the controller and model stay separate and can be independently developed. However, a lot of tutorials I see online and even in the book Pr...
I followed these tutorials:
http://www.asp.net/learn/mvc/tutorial-39-cs.aspx
http://schotime.net/blog/index.php/2009/03/31/integrating-xval-validation-with-linq-to-sql/
in order to enforce data validation using Data Annotation for a LINQ-To-SQL-generated class. The metadata class looks like this:
[MetadataType(typeof(PositionValidatio...
Hello everyone,
Can someone help me with getting values from a dropdownlist in asp.net mvc?
I can get values from textboxes,etc...but,how do I get these 2 things...
Getting Selected Item Value of the drop down list from the controller class
Getting all the list of items of the drop down list from the controller class
Thanks
...
I'm in a hoo-ha with my boss as I can't shift to using newer technologies until I have proof of some outstanding issues. One of the main concerns is how repositories deal with connections. One of the supposedly largest overheads is connecting and disconnecting to/from the database. If I have a repository where I do the following:
pub...
Its known that DTO doesnt have methods.
Since the controller uses the DTO objects , there is a dependency . should we set expectaions on the properties of DTO(mock DTO properties) while testing the controllers.?
thanks
...
Hello,
How do I have 2 buttons and each button to perform a different post back action?
For example :
I want button1 to submit the
contents of the form.
I want button2
to display some data from the
database without storing whats in
the form.
Right now,since im using form collection,both buttons seem to store the data.How do I diffe...
hi folks
i have build everything in order to create a model from 2 models so that i can create a view for the single model. one table holds info for 1 quote and the second table holds a list of items within that quote.
the error i get is:
The model item passed into the dictionary is of type 'graniteConcepts.Controllers.QuoteViewModel'...
In a Action, I am calling
RedirectToAction("login", new { test = "1" });
And the page doesn't seem to be redirecting. The action "login" is in the same controller.
What could the issue be?
...
I am trying to get UpdateModel to populate a model that is set as only an interface at compile-time. For example, I have:
// View Model
public class AccountViewModel {
public string Email { get; set; }
public IProfile Profile { get; set; }
}
// Interface
public interface IProfile {
// Empty
}
// Actual profile instance used
publ...
Hi
Normally my URLs look like the standard: www.example.com/controller/action
Now I want to setup my administration section like:
www.example.com/admin/
www.example.com/admin/user/list
www.example.com/admin/content/add
etc.
So the format is: www.example.com/admin/controller/action
I can't seem to figure out how to setup the ro...
hi
I want to be able to authenticate a user by using their domain UserId and Password.
How can I do this, the default ASP.Net MVC application allows the user to register a userId and password and then log in.
I dont want the user to be able to register, however he should be able to enter his windows domain userId and password and be au...
I used the ASP.NET MVC REST SDK for building atom feedS for our exception logging dashboard and it worked perfect.
When creating the syndication content, I used CreateHTMLContent and added a PRE tag around my HTML content string. Now it shows in a nice formatted way on internet explorer. But when reading the feed through outlook 2007, ...
Anybody have asp.net mvc 2 running with visual studio 2010?
Is it as easy as referencing the output of the mvc 2 source code?
...