asp.net-mvc

How to configure IIS7 to work with an MVC 2.0 Framework 4.0 application

I have an MVC 2.0 application that I'm playing around with in VS2010 which is a .Net Framework 4.0 application, which works great on my local dev machine, but fails when IIS gets involved, giving me all sorts of IIS errors. Can someone please tell me the sequence of steps I need to do in order to get an application set-up in IIS 7.0 (ru...

Database of registered users in ASP.NET MVC

Simple question. I know that in the default MVC application in Visual Studio, you can register a user. So I want to be able to put that info in a database and use ADO.net or LINQ to SQL to be able to communicate. How do I do this? ...

how do I get ActionDescriptor from either ActionExecutingContext or AuthorizationContext?

I'm writing a method that just uses the ActionDescriptor property but I can't figure out how to avoid repeating the body of the method so that it can take either an ActionExecutingContext or an AuthorizationContext. Both of these types have an ActionDescriptor property, but they don't inherit it from a common type or interface that I ca...

does a change to an ASP.NET site kill active sessions?

I'm concerned about the possibility of my users' sessions getting swept away. I am using the default ASP.NET Session object and session cookies. I know that sessions can time out, and I have set the timeout value for my sessions to several hours to avoid surprise timeouts. But there are at least two other cases I'm worried about. (1) I...

ASP.Net MVC Database-driven menu with caching

Hi. I am trying to create a menu for my website. It needs to meet the following requirements it must be database driven, pulling data from DB to build up the menu structure the data being pulled from the DB needs to be cached - I do not want to hit the DB for each page request At the moment, I have a simplistic example running, but ...

Dynamic url routes ASP MVC

Im trying to make a very simple application that lets my client create their own pages. The hard part is to let them create thir own URL. Client need to fill in: Page name (ex. About us). Page description (ex. We are a big company). Page URL relative (ex. /About) When client enter this information and save, it should be saved in the...

Dynamic typecasting in asp.net mvc Edit action: how can I handle multiple datatypes without throwing an exception?

I'm making a generic MVC viewer/editor for data objects I've designed, modeled after ActiveRecord. The data objects are completely generic, they can have primary keys that are strings, ints, int16s, whatever the database uses (the persistence layer at this organization uses all sorts of datatypes for primary keys and I want this MVC "br...

ASP.NET MVC "GET" and "POST" constants

Does ASP.NET MVC have any constants for the the strings "GET" and "POST"? ...

List of Actions for specific controller

I have a list of controller names and would then have a list of all actions in a given controller (name, GUID). The list of all controllers found here. I was also reading List all the actions on a controller with specific attribute which would match for my purposes as I also need actions with specific attributes. But I have only the na...

ASP.Net MVC - Submit buttons with same value

Hello, I have a single form with multiple submit buttons that have same value. Example: "Proceed". Now, in ASP.Net MVC's post controller method, how do I know which button is pressed? [AcceptVerbs(HttpVerbs.Post)] public ActionResult DepartmentDetails(string submitButton) The value of submitButton will always be "Proceed". How do I ...

form has many rows, how to reference each row in my action?

I have many rows that I display on a page, and each row has a textbox with a user entered value in it. When the user submits the form, I have take each row's textbox value, and do some db work on them. The db work is performing updates, so I have to be able to reference the ID of the row also (which I have to store somewhere??) what a...

ASP.NET MVC and Login Authentication

I have searched many posts here regarding custom user authentication but none have addressed all of my concerns I am new to ASP.NET MVC and have used traditional ASP.NET (WebForms) but don't know how build a login / authentication mechanism for a user using ASP.NET MVC. protected void Login1_Authenticate(object sender, AuthenticateEven...

naming form files using square brackets

I've noticed in some php applications, that form fields are labelled with [] in them. Say a shopping cart page, that lists all the items where you can edit the quantity. is the [] type naming used to get the correct row? Just trying to figure out how I should name each textbox? should it be like: name="quantity-<%= items.RowId %>" ...

passing values to a dropdownlist in an mvc view

I am a newb to MVC programming. I am passing values from other db tables to my edit and create views to populate some dropdownlists. It's working great. I have code like this in my controller for edit and create: var db = new MyProgramDataContext(); Order order = orderRepository.GetOrder(id); ViewData["customer"] = from c in db.custo...

Changing Model Binder per Controller instead of by type or with attributes?

I'd like to be able to swap model binders out on a per Controller or per ActionMethod basis. AFAIK the only options supported by the framework are to bind a model binder to a specific type. How could I change my model binder per Controller or per ActionMethod in a clean way? ...

MVC -- Impersonate a Form POST

I have created an MVC application that dynamically routes actions and controllers based on user data, so that there are no standard actions, but dynamically named actions. In order to route the controller and action correctly, every route must go through a centralized Index which determines if the user has gone to a valid System in this...

want to move all business logic to BLL layer, but need to pass in formcollection, is that clean?

My asp.net controllers action takes the FormCollection as a parameter. I then loop through my own collection, do a lookup in the form collection for a value etc. I moved all my code to my business logic layer, and just call my business logic layer in my action like: SomeManager.Update(formCollection); But I am feeling a bit weary pa...

Column Sequence and the Entity Framework

So, when you bind a collection of Entity objects to a grid component, the grid displays those fields in the sequential order they are found in the SQL Table they came from. This shows that the ordinal position of the fields are associated with their corresponding entity properties... somehow or other. So here is the question: How can ...

How can I get a fusion binding log on a host that does not have it enabled?

I'm trying to run an Asp.net MVC 1 app on a host that doesn't support MVC per this post but does support .net 2,3,3.5 However the error message I get back doesn't tell me much: Server Error in '/assetmanagement' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to se...

SMTP message not updating it's content

When users register on my site I send them activation mails. I recently updated the message users receive in the mail but users are still receiving the old message. Anyone know why? Sorry. I'm using C#, my website is in ASP.NET MVC. I'm using a class I've created, Mail.cs, where I create the MailMessage which looks something like thi...