asp.net-mvc

MapRoute not working, URL still says page not found?

Maybe I am confused here but I am trying to go to http://ryan.local.myappname.com/Order other things such as /Home work and I checked and found this routes.MapRoute thing and added this: routes.MapRoute("Order", "Order", new { controller = "Order", action = "Index" }); But it still says page not found... what the dealio? ...

Calling an Action from an HttpModule/ResponseFilter

I'm building a Response Filter that will go through some tokens in an outputted page and replace them with other data. I would like to get the replacement data by calling an Action on a Controller. However, I'm having trouble accomplishing this. This question really comes down to how to instantiate a Controller and call an Action from...

How can I exclude some public properties from being serialized into a JsonResult?

Hi, I have a custom viewmodel which serialized using a JsonResult. The ViewModel has some properties which have to be public, but at the same time these properties should not be visible in the resulting Json output. I've already tried using the [NonSerialized] attribute, but that did not seem to have any effect. Is there any simple w...

asp.net mvc app_data folder

Hi, I want to store a large number of images on a server gallery. I can create my own folder for that, but in the default template there is a folder named App_Data. Obviously, I imagine that creators of the template meant for us to store data there. But I can't find a way to open anything in that folder. Is it intended? Or how do I do th...

ASP.NET MVC: Best Way to Enable Different Modes of Authentication?

I'm currently working on an application that will likely be deployed amongst various organizations within my current workplace. I need to develop a testable and properly designed authentication framework so that for each implementation folks can choose to use either Windows Authentication, Forms Authentication, a home-grown Single-SignO...

C# ASP.NET MVC: Show Page Render Time

Hello, I'd like to add an output to all my ASP.NET MVC pages via the master page which shows the render time of the current page. How could I do this? ...

ASP.NET MVC: how to authorize for users or client IP?

In an ASP.NET MVC application, I'd like for certain controllers to only be accessible to authorized users. AuthorizeAttribute works great for this. However, I'd also like those controllers to provide access to certain IP numbers even if the remote user is unauthorized. Should I override AuthorizeAttribute to provide this functionality...

A ASP.NET MVC page with multiple instances of user control consuming the independent data.

First let me thank all of you for numerous useful posts I have read during my recent ASP.NET MVC development. My questions is as follows: I have a ASP.NET MVC application with loosely coupled model, meaning I use a business layer assembly in a controller to access the data and return data to a view by setting Viewdata["MyData"]...

How to Create a WCF Rest Endpoint for Uploading Large Files to ASP.NET MVC

Can WCF be used to create an endpoint for uploading large files to a website via an ASP.NET MVC controller method, with a jQuery progress bar in the browser being updated with Ajax or Json? How would it be done? Are code samples available? ...

Not load entire relation

I have a simple database from which I am generating Linq2SQL classes using a datacontext. In one part of my application I would like to load the entire relationship such that I get child records. In another part of the application I am passing that relation across the boundary between model and view and I would like to not pass the ent...

string.Format with variable names instead of numbers

I've read some posts with some self implementations of this but I think now there should be some method in the ASP.NET MVC that should have this functionality. I suppose there is some kind of method that can do what string.Format does: string.Format("example {0}", 1); but instead of using {0} can work with variables names just like...

Asp.Net MVC UserControl

I'm porting an application from WebForms to MVC. I have a WebForms UserControl that is used throughout the site and which contains presentational and business logic, and in particular some 'initizliation' logic (in the Page_Load) My understanding of MVC UerControls is that they have no dedicated controller and thus contain no logic, a...

ASP.NET MVC free book

Can anyone point me to a free ASP.NET MVC book? ...

How do I pass contructor arguments with dependency injection using Castle.Windsor?

I am wiring up my first SubSonic 3 application (in an ASP.NET MVC 1.0 front-end) and am looking at Rob's SimpleRepository. I'm using Castle.Windsor as an injection framework. In my application startup, I configure Castle to bind a SubSonic SimpleRepository to a SubSonic IRepository. Nothing complicated there. However, the SimpleRepo...

ASP.NET MVC with LINQ to SQL: How to implement Authorization to Entities in the Repository?

With Domain Driven Design in mind, how would you implement user Authorization in a repository? Specifically, how would you restrict what data you can see by the user provided login? Lets say we have an e-commerce Mall that stores products, where only some products are maintained by any given store manager. In this case, not all produc...

Is there any need for LINQ to SQL Entity classes to implement INotifyPropertyChanging in an ASP.NET MVC Project?

I am using the code generated using SQLMetal for my database entities. They all implement INotifyPropertyChanging and INotifyPropertyChanged, and because of those dependencies, their is a ton of extra code in the property setters. I couldn't think of an instances for a regular ol' web page where one object would need to be notified of an...

What is needed in the HttpContext to allow FormsAuthentication.SignOut() to execute?

I am trying to write a unit test for our log out method. Amoung other things it FormsAuthentication.SignOut(). However, it throws a System.NullReferenceException. I've created myself a mock HttpContext (using Moq) but it is obviously missing something. My mock context contains: A mocked HttpRequestBase on Request A mocked HttpRespo...

ASP.MVC Ajax response returns form with some JS not executing

ASP.NET MVC Page has one link (Ajax.ActionLink), which gets the form to create and puts it in one of the div. I see the form in div but none of the JavaScript returned is getting executed. I am using JQuery validation and needs to run the validate() on the form so that returned form from AJAX request is validated. Is there any setting ...

Is it possible to run an ASP.NET project and an ASP.NET MVC project side-by-site on the same website?

I have an existing ASP.NET website with some custom routing, within a Solution that also contains Business Logic projects. I want to create a new project within the Solution, which is an ASP.NET MVC website. This website will also call the Business logic, and the ultimate aim is to port most of the code from ASP.NET to ASP.NET MVC. Bu...

ASP.NET MVC Paging, Preserving Current Query Parameters

Hello, I have a grid with contact information which I need to be able to page through. All the plumbing is already in place, with one last detail. Paging is done through a simple p Querystring parameter, e.g. www.myurl.com/grid?p=3 would be the third page; the repository is automatically fetching the right data, and also the total coun...