asp.net-mvc

Model Validation problem in ASP.NEt MVC 2 RC 2

Hi, I have facing the following problem after the update. I have a Model with Class level Validation plus property level validation in it. After updating to MVC 2 RC 2. The model validation fails on Model binding. What i actually understand that new mechanism trying to validate the model when you first request it or say on GET and it ge...

Where to store and set user site wide data in ASP.NET MVC

I have an application in which a user can choose from different (learning)groups. User has only access to registered groups. When the user enters the site, he can choose (in a dropdown) which group he wants to see, so the complete site filters content related to that group. So every controller needs to access this global "group" object. ...

What is causing these SQL casting errors on my ASP.NET MVC/AJAX site? [Video showing problem]

I'm frustrated... my site has suddenly become very unstable. So much so that hitting refresh over and over will cause it to crash. To investigate, I turned off all error handling so I could see some YSOD's. Instead of trying to write it all out, I made a video showing the issue. You can see it here on YouTube. Here's a copy of the stac...

ASP MVC Restful urls and Ajax calls

This is a common problem in ASP MVC. I have a simple search form with four fields and a search button. The search button uses jquery to populate a html table with the results. The problem is that we are also trying to maintain state, as in the user goes to a different page then hits back, we want to fill the search fields with the searc...

Why would I hard-code user permissions in my controller attributes?

I have seen example code that looks like this, which seems perfectly reasonable: [Authorize(Roles = "Admin, User")] public class SomeController : Controller But I have also seen several examples that look like this: [Authorize(Users = "Charles, Linus")] public class SomeController : Controller Why would I ever want to do this? ...

Sharing data between actions

I'm given the task of programming a website and I'm new to website creation. The website has to show an overview of trips and allow navigation to a single trips detail and this trips places. Our databaselayer will return a list with trips and all its places: class Trip { List<Place> places; } List<Trip> trip = datalayer.GetTrips(); S...

get selectlist first value in my controller

Hi All, I just populated my SelectList variable inside my controller. Is there a way to get the first value of the selectlist into another variable? thanks, rod. ...

How do you use zipped objects in cache?

If I have lots of objects that I want to cache how would I go about compressing that data? It will mostly be string data which may be relatively small, but if I end up having a ton of those in cache the size would add up. I have memory limits, but my CPU is only hitting 15% at peak. I think I heard that stackoverflow was doing something ...

Good resources for learning how to build a solid logging/debuging infrastructure for .Net MVC web sites/apps

Hello! I was wondering if someone could point me towards some good resources for learning how to build a solid logging/(remote) debugging infrastructure for .Net MVC web sites/apps to gather info for when things go bad. I know SO was built using .Net MVC and I wish I could pick Atwoods brain for even an hour because I bet he had some i...

Creating local machine accounts using ASP.NET MVC

We are trying to create a web interface allowing local user accounts to be created on the web server. Only local administrators can have this right. It cannot be delegated under the local security policy. These are approaches we have tried so far: Running the Application Pool as a local administrator: this does work, but its not an a...

Not all e-mails being sent using SmtpClient in an ASP.NET MVC getting delivered. Why? How to resolve?

Here is the set-up: I have a Notifications controller that is called from task scheduler 1x/day The action method pulls upwards of 300 addresses, loops thru them and uses the SmtpClient class to send an individual e-mail to each recepient. From what I can tell the process runs fine with no exceptions ... except that not all e-mails a...

asp.net mvc 1.0: How can you implement dynamic, role-based navigation?

Building an application, and there will be different levels of access. What is the recommended way to restrict the display of navigation elements to those appropriate to the current user? Are there any built-in helper for this? ...

How can I shared controller logic in ASP.NET MVC for 2 controllers, where they are overriden

Hello, I am trying to implement user-friendly URLS, while keeping the existing routes, and was able to do so using the ActionName tag on top of my controller (http://stackoverflow.com/questions/436866/can-you-overload-controller-methods-in-asp-net-mvc) I have 2 controllers: ActionName("UserFriendlyProjectIndex")] public ActionResult I...

MVC2 Apps (and others) sharing WCF services and authentication

Hi, I've seen several similar scenarios explained here but not my particular one. I wonder if someone could tell me which direction to go in? I am developing two (and more later) MVC2 apps. There will also be another (thicker) client later on (WPF or Silverlight, TBD). These all need to share the same authentication. For the MVC2 apps...

jquery not executing on pages with custom routes

I have a number of pages that include the same partial view which contains a set of jquery tabs. The purpose of the partial view is to componentize a common set of tabs. The tabs are essentially links to the other pages. The urls for the tabs on the partial view are provided by the view model passed to the partial view. The urls are ...

How to serve of content files with "abnormal" file extensions in ASP.NET MVC

So, I want to serve up some .ejs files (EJS templates.. see http://embeddedjs.com for more info) from my /Content or /Scripts folder in an ASP.NET MVC project. This behavior doesn't seem to work out of the box. Is there a configuration-based solution to make this happen? I suppose this would apply to those wanting to serve any kind of "...

Newbie Needs help with basic MVC Oauth Twitter set up

Hey everyone. I'm a hobby developer and I am fiddlng around with asp.net MVC and was trying to just get the basic Oauth to work via Twitter. All I did was put a controller named Twitter with this code: (it's from an online example for webforms but i slightly modified it and put it into 2 action methods, index and callback.. is this ri...

Sharing application configurations across a solution

I have a solution which has multiple output projects (a website, and admin tool, and a SOAP API layer). They each share common projects in the solution (the service layer, data layer etc). In one of these common projects, I am looking to store a config layer. Right now, we have three seperate appsettings config files for each output pr...

best way to set jquery datepicker dates when user paging through data

I have a report where I am using jquery ui's datepicker for the start and end dates for the report data. When a user pages through the data, I want the maintain the date ranges on the picker. How can I do this? Say I modify the url's for the next/previous buttons based on the values of the datepicker, how would I reset the datepicker ...

How do I convert this WindsorControllerFactory to a UnityControllerFactory in either VB.NET or C#

I have been following along in the book Pro ASP.NET MVC Framework by Steven Sanderson. I am trying to rewrite an application to use Unity IoC instead of Castle Windsor IoC. I want the Unity implementation to register all of the controllers like the Windsor one does. Here is the WindorControllerFactory code: public class WindsorContro...