asp.net-mvc

CSS file only loads in IE when fetched via an ASP.NET MVC Controler + Action

I'm serving up a site's CSS content via an ASP.NET MVC's Controller + Action. The css "file" appears to deliver correctly down the wire but only IE will apply it. Other browsers (Firefox, Opera, Chrome) ignore the CSS file and render the page without styling. IE8 works perfectly. This is the essential code that I'm using to return the C...

Are virtual servers quirky with Windows Server 2003, IIS 6, ASP.NET MVC?

For several months I've been working on a customer site building a web site using ASP.NET MVC with C#, SQL Server 2005, ADO.NET Entity Framework, JQuery and some ESRI web APIs and geodatabases. The test server is running IIS6 on Windows Server 2003. Over this time I've seen some weird things that have caused a lot of rework: JavaScript...

asp.net mvc session?

Im building an admin interface for a medical records management app. My client has asked me for a way to easily select the patient the user wants to work with without having to select the patient everytime he wants to perform an action. So, say for instance he wants to store a record for the patient's current status (weight, size, etc) a...

How can I tell which image has been clicked?

<%using (Html.BeginForm("ChangeLanguage", "AppController", FormMethod.Post)) { %> <div id="China"> <input id="imageChina" name="btnsubmitLan" type="image" value="CN" alt='China' src="/Content/Image/IconHH/FlatCN.gif" /> </div> <div id="US"> <input id="ImageUS" name="btnsubmitLan" type="image" value="US" alt='E...

Example of using HTML forms with Sparkview engine on ASP.NET MVC2

I am playing with Sparkview 1.0 on ASP.NET 4.0 with MVC2. Trying to create a simple HTML form. When the form loads, it renders as expected. Click Save button on the form, the model validates, returns an error about length of field (expected) but then the !{ Model.Name } tag gets rendered as the text ${ Model.Name } rather than the actua...

How can I get Asp.net MVC add view dialog out of Views folder?

Since I followed this article to implement a theme engine in Asp.net MVC website. But by doing this I can't have "Add View" dialog by right click on ~/Themes/ folder. By default "Add View" dialog can only show up when I click ~/Views/ folder. Can I have any chance to set it show up for ~/Themes/ Folder? Edit: My Teammate want to change...

Set HttpContext.User for the session

I've implemented custom authentication in ASP.NET MVC. If a valid user tries to login, I set the HttpContext.User = user in the Logon method of the AccountController. But it remains there for only that request. How can I set it for the session? I used an alternative, set HttpContext.Session["CurrentUser"] = user. If I want to see if the...

Implementing refined search - ASP.NET MVC

In my ASP.NET MVC application I have a view that displays a list of Products in the system. I would like to implement an option for users to filter the list of Products by selecting parametes, similar to the way it's done on www.codeplex.com. I would like to know how you would go about doing this in the most efficient and simple way? Any...

Need an ASP.Net eCommerce app that I can make specific changes to (MVC preferred)

I'm planning to set up an online store for a friend, unfortunately his product line introduces some demands most out-of-the-box solutions don't fit. I'm hoping somebody here has had some experiences with an open source package that they can recommend. The specific issue is that the products are going to number in the hundreds of thousa...

Link to a root controller from area controller in ASP MVC

How can I link to one of my root controllers from one of my areas? <% Html.RenderAction("Action", "Page", new {area = "root", name = "Admin"}); %> This gives me an error: No route in the route table matches the supplied values. I have a controller named Pagein a folder named Admin in my root controller collection. I can reach th...

Create reusable 'base code' using MVC2-RC?

I am trying to write a simple library for MVC2 projects that takes care of user login, e-mail validation, password recovery, etc. Since some of these steps involve user interaction, I need to have Views and Controllers in that project. In MVC2 Preview 2, one could do this by abusing areas (at least, it seems) since they were implemente...

Changing the default MVC project template

I want to change the default project structure for a new mvc project. I have seen a webcast where Scott Guthrie does this but cannot find it. Has anyone tried this? ...

Editing and Updating Entity Framework entity in ASP .NET MVC

Hello, I have an entityframework entity called "ABC" (attributes ID and Title). On update record view, I have added the ID as hidden field and title is the text box. Controller looks like something: public ActionResult UpdateAction( ABC obj ) I get everything fine and fair in obj - i.e., the title, and the ID. Now to update the re...

Is it possible to map multiple DTO objects to a single ViewModel using Automapper?

Hello, I was wondering if it is possible to map multiple DTO objects to a single ViewModel object using Automapper? Essentially, I have multiple DTO objects and would like to display information from each on a single screen in ASP.NET MVC 2.0. To do so I would like to flatten the DTO objects (or parts of them...) into the Viewmodel and ...

Asp.net MVC 2 ValidationInput

I using ValidationInput(false) at my Action, but ASP.NET MVC 2 P2 still validating my request. Why? Is it a bug of Preview 2? ...

Best Practice: How to get several dependency repositories into a ActionController?

I have a InventoryController that gets a IInventoryRepository inyected, however my needs have changed, and now one of the controllers methods also needs to use another 2 repositories, ILoansRepository (to see the get info about loaned inventory items) and another one, where some stats and extra info are found. The way it works is that a...

ASP.NET-MVC data/model best practices for a newb

Hey :) I am quite new to ASP.NET MVC and MVC in general. Moving from the old school "spaghetti" design practices to WebForms was a big change, but this seems bigger (but better) in my mind. I have some questions regarding data specific tasks. For the sake of simplicity, say I have a database table called PIN with the column structur...

Software stack for convention based ASP.NET MVC development

Besides ASP.NET MVC's obvious conventions, what libraries do you take advantage of that minimize boot strapping, mapping objects, data access and such? I want to spend more energy developing domain logic as opposed to dealing with the details of object persistence (for example). I have used StructureMap and NHibernate in the past to gr...

Malicious input in ASP.NET MVC

Hello, I have ASP.NET MVC 1.0 and Entity Framework v1 application. By default, content submitted by user is validated for malicious input. (See here). HTML encoding user submitted data, prevents JavaScript injection attacks. Entity Framework internally uses parameterized SQL which will stop sql injection. Is this sufficient ? What e...

How to dispose NHibernate ISession in an ASP.NET MVC App

I have NHibernate hooked up in my asp.net mvc app. Everything works fine, if I DON'T dispose the ISession. I have read however that you should dispose, but when I do, I get random "Session is closed" exceptions. I am injecting the ISession into my other objects with Windsor. Here is my current NHModule: public class NHibernateHttpMod...