asp.net-mvc

Stepping through ASP.NET MVC 2 source

I've been trying to set up the ASP.NET MVC 2 RTM Source for use with my app, so I can step through things like model binding when debugging. However, I haven't been able to get it to work - I'm getting errors like: The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assemb...

Spark view engine - named content ignored with RenderAction

Application.spark: <html> <head> <use content="head"/> </head> <body> <use content="view"/> </body> </html> Index.spark: # Html.RenderAction("Hello"); // This renders _Hello.spark _Hello.spark: <content name="head"> <script src="/hello.js"></script> </content> <p>hello</p> And head content of _Hello.spark...

ASP.NET MVC - Stop Html.TextBoxFor adding a dot to the Name attribute

Hi all, I'm fairly new to ASP.NET MVC and I've got a problem with Html.TextBoxFor() - it's giving the rendered input's name attribute a dot. <%= Html.TextBoxFor(m => m.Box.Name, new { id= "txtName" }) %> renders the following HTML: <input type="text" value="" name="Box.Name" id="txtName"> I'm using the jQuery Validation plugin for ...

ASP.NET MVC2 Creating ViewResults outside of controllers

Again an easy question for ASP.NET MVC 2. public ActionResult MyAction(MyModel model) { if (ModelState.IsValid) { // do great stuff and redirect somewhere else } // model has errors return View("~/Home/Index", model); } The question is that I want to return a view which is ...

Strip all header in ASP.NET MVC

We have a mvc action that will send data to a embedded device, but would like it not to send any header information. Is this at all possible with a ActionFilter and how? ...

Are there any new ASP.NET MVC 2.0 resources or books that are recommended?

I am already familiar with steven sanders and manning books on asp.net mvc 1.0. I am looking for any asp.net mvc 2.0 books with more recent examples. A good resources are also welcome. ...

ASP.NET MVC Base Controller Function not firing when I need it to.

I'm noticing some behavior that I don't like, and I'm wondering if this is normal. I've got a BaseController that is Inheriting from Mvc.Controller, and I've got a View function inside that is to fire on every page load. Protected Overrides Function View(ByVal viewName As String, ByVal masterName As String, ByVal model As Object) As ...

Not display/write specific html if model.entity is null

Normally I work in ASP Classic, and am still a bit green on ASP.Net MVC. I have my model with its fields or entities (might not be the right word hence why not able to find if previously answered, forgive me), and some of these will have null values such as hyperlinks, email address, specific types of phone numbers, etc. What I want to...

Pattern for specifying the "return" controller/action in an MVC2 application

Problem: Calendar application built using ASP.NET MVC2 From the main calendar page, the user can select an add appointment link that brings up a form to create a new appointment. After the appointment is created, we want to return to the main calendar page, potentially with an error or confirmation message. There are other pages within...

Question on Federated Authentication using Windows Identity Foundation

Hello All, I am developing an Asp.Net MVC website using Windows Identity Foundation and STS website for authentication. it works fine as whenever a user tries to access a URL, it redirects to STS website if that session is not authenticated. Now I want to add a page in the application which should be available without authenticating in...

How to make Url.Action not to preserve route values?

I have an MVC 2.0 application where I have a list of items that can be browsed by their first letter and I have a tab on the master page for the whole list of items. What I would like is that the tab on the master page always should go to: /items And there are the letters of the abc that go to the items starting with the letter. So ...

Possible to disable/make item not visable in select list?

Is it possible to make an item disabled/not visable in a select list? What I'm trying to accomplish is to, depending on a number of checkboxes, if they are selected, the fields should appear in the dropdown. However, I do have manditory fields that always should be in the dropdown and it should all be in a serten order. Checkboxes: <...

Occasional "Access denied" to 'C:\WINDOWS\TEMP\' files

In my ASP.NET MVC application I sometimes get these errors when I try to open or generate LocalReport from Microsoft Reporting Services assembly: Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the r...

Implementing Security in ASP.Net MVC2

I have a CMS application in which i want to apply security on user actions like user1 can have rights to add new page but doesnt have rights to delete that page im maintaining this rights in database. Please tell me what may be the best approach to implement security to this CMS ...

Where to put data manipulation and business logic code in ASP.NET MVC application?

Having watched samples from Rob Conery's Kona application, I see that he is using two things with IoC - ISession, where he has data layer code and Services, where he has some additional business logic that we need to perform when manipulating data in datastore. For instance, we might not just add a record to the DB but also change proper...

ASP.NET MVC: WHY ValidateInput(false) works only when the postback action and controller are explicit on the Form?

Hello, The whole weekend, I've been learning how to use TinyMCE with ASP.NET MVC. I was getting the XSS error ("A potentially dangerous Request.Form value was detected from the client(...)"). To deal with that, I was advised to use the [ValidateInput(false)] attribute to release the checking, but without success. Until, by accident, I...

How to disable Validation in ASP.net MVC2 if the parameter of the action is a model

In ASP.net MVC 2, if the parameter of the action is a model, how to disable validation to dismiss the exception like 'A potentially dangerous Request.Form value was detected from the client (Post.Title="<b>Title</b>"). '? For example, in MvcMusicStore (Which is an official demostration of ASP.net MVC2), the following code is in charge o...

ASP.NET MVC 2 "RequiresRole" attribute does not work

Hi to all. I'm developing a ASP.NET MVC 2 web application. So far, I managed to define access rules for every controller function, using "RequiresRole" attribute. Suddenly, this way of defining access rules stopped working (now every user can invoke any of the controller methods). :S. I tried debugging, and it seems that user-roles are...

Browser issue with parsing json

Hi, I am developing application in Asp.net MVC. I submit the form with using jquery: var Data = $("#frmForgotPassword").serialize(); $.post("<%= Url.Action("ForgotPassword","Account") %>/", Data, function(retdata, textStatus) { if (textStatus == "success") { if (retdata.status == false) { $("#error").html('<p c...

ASP.NET MVC application displays nothing in IE/Firefox?

I use Chrome as my primary browser, but wanted access to Firebug to debug some javascript. With webforms projects, I simply run them, copy-paste the address the project is running at into Firefox or IE and go from there. This doesn't seem to work now that I'm using MVC - Firefox and IE both render a white page. A view source on either br...