asp.net-mvc

asp.net mvc generic/custom views

the routes are as follows site.com/{section1}/{page1} site.com/{section1}/{page2} site.com/{section2}/{page3} etc. the pages are 2 column each where the left bar is different for each section the page content is fetched from the database based on section + page combination I'd like to make the page markup/layout/css be done/upload...

Updating database on website from another data store

I have a client who owns a business with a handful of employees. He has a product website that has several hundred static product pages that are updated periodically via FTP. We want to change this to a data-driven website, but the database (which will be hosted at an ISP) will have to be updated from data on my client's servers. Ho...

ASP.NET MVC: OutputCache and http headers - Cache-Control

Hi guys I have just started using OutputCache on some of my controller actions and I am not quite getting the response I would expect. Basically I have set Location = OutputCacheLocation.Any and the http header is as follows: Server ASP.NET Development Server/9.0.0.0 Date Wed, 15 Jul 2009 02:14:21 GMT X-As...

How do I time out a ASP.NET MVC logged in user?

How do I time out the session a ASP.NET MVC logged in user after about 5 mins or so forcing him to have to login in order to continue? ...

In ASP.NET MVC, should OnException be used for application exceptions?

I'm building a small application in ASP.NET MVC. I'm still trying to find my way around some of the design problems that I encounter. One of them is the use of exceptions. I've built my model so that it throws an exception whenever an object does not exist or is not accessible to the user. I think I made the right choice, in my opinion....

How do I store List ~ Array in the Application State (C# ASP.net MVC)

I'm trying to stick some data into the app so I can then build a public string get + linq query to pull out just the bits I want when I need them. I'm just struggling to store it and then how I'd go about pulling it back out so I can query against it... public void CommonDatatoApp() { CDataResponse cCommonData = this.GatewayReferenc...

Should I implement OpenID authentication? American/Japanese users

I've got a membership site using the default ASP.NET membership setup. The user accounts are free, with capability of paying to activate other key parts of the site. In keeping with the nature of the site, i.e. embedded Google maps, Street View, and using Google's CDN to host jQuery/jQueryUI for me... it'd be nice to offload the authent...

Setting ViewData item in a Partial to be read in a View

I have a View which I call RenderPartial. In the Partial usercontrol I set ViewData["IsTextAreaVisible"] = true; In my View after the call to RenderPartial I check the value of ViewData["IsTextAreaVisible"]. Even though the usercontrol had set it, the View thinks that it is null. Is this a bug or is there a better approach? Thanks ...

asp.net mvc and fckeditor

would like to use fckeditor or similar for building/editing webpages on the fly but there are a few other old questions where there are issues am looking for any recent experiences/alternatives ? thanks ...

How to stop MembershipService.CreateUser() from auto login on ASP.NET MVC?

I created an App with ASP.NET MVC 1.0 and wish to use a custom method (for admins) to create a user. I took the Register method (in the Account controller) and renamed it to Create. I then commented out the line FormsAuth.SignIn(userName, false); to avoid the newly created user to sign in. When I complete the create user form, the use...

Ideas to improve/enrich a WebForms application by adding ASP.NET MVC elements to it

I'm currently present with the following situation. We have a huge enterprise application written with WebForms. Refactoring it or completely rewriting it is out of the question. So I'm not talking about migration WebForms -> MVC. However, I understand one can technically add MVC functionality to coexist with the rest of the project. I...

How does ASP.NET MVC Generate JsonResults?

I want to inject some Json into the Html page returned by the server? Is there a public function that returns the Json string when Json(someObject) gets called? Note that I don't want to return Json to the browser in a seperate request. I want to convert an object graph to json and inject it into a script block. Thanks ...

ASP.net MVC Action URLs with lambda expression

I'm sure I have seen this syntax <%= Url.Action((MyController c) => c.MyMethod("a")) %> or something like it as a way to generate action URLs in ASP.net MVCs without magic strings. However, I can't find that Action overload. I have ASP.NET MVC 1.0. Where is it? ...

Unit testing controller actions with complex viewModels

Hi, I'm just getting going with ASP.NET MVC and I'm also new to unit testing :) So far, so good. I have a controller action that sets up an index view using a viewmodel. Testing the controller action is straight-forward as I can pass a fake service class in the controller's constructor, but my viewmodel is quite complex and fetches i...

Adding Items to Visual Studio Context Menu

I'd like to add an item into the Visual Studio 2008 context menu exactly how ASP.NET MVC projects have "Add View" or "Add Controller" items in the context menu. How would I accomplish this? Do I have to write an add-in? Thanks, Nathan ...

MVC RouteLink being double encoded

I have the following link defined in a page that will be built based on the route defined in the web.config <%= Html.RouteLink(product.DisplayName, "ShopProductNames", new {Id = product.Id, ProductName = product.DisplayName.Replace(' ', '-') }) %> I need to URL encode the DisplayName in the URL of that link, however, when I add encodi...

asp.net mvc change master page & .css dynamically

Is there a good way to change the MasterPage and/or .css dynamically in asp.net mvc based on the user preferences? I understand I can change the master name as follows: return View("viewName", "master-name", oModel) and the view using a different contentPlaceHolder perhaps but that requires changing each controller+action. I'd have ...

Handling Rich Text in an MVC application

What are the best practices regarding working with rich text in a web application? I don't want to leave myself vulnerable to script attacks. Should the data be encoded going into the database and then decoded when displayed back to the user? Any advice on rich text editor's that handle things like removing script tags or encoding the...

Is MVVM possible/viable in a DHTML RIA application (no Silverlight/WPF)?

Note: This is a long winded question and requires a good understanding of the MVVM "design pattern", JSON and jQuery.... So I have a theory/claim that MVVM in DHTML is possible and viable and want to know if you agree/disagree with me and why. Implementing MVVM in DHTML revolves around using ajax calls to a server entity that returns J...

DataSources folder in MVC?

Is it possible to access to the "DataSources" window in Visual studio in an MVC project? We are trying to use Report Viewer in our MVC project. Tutorials for setting it up use the DataSources window, but I think this is just a WebForms project feature. Can anyone confirm that that is the case? ...