asp.net-mvc

Do you lose functionality when hosting ASP.NET MVC on IIS 6? If so, what?

As a dev team, we're looking to switch to asp.net MVC and I've heard rumors about IIS 6 not being able to support all of the MVC functionality. Is this true? Is there any official set of functionality supported in IIS 7 vs IIS 6? Should we completely avoid running it on IIS6? ...

Display Content Result Text from AJAX Request

I have an Ajax.Action link hooked up to a post method in my controller class that returns a ContentResult. I'm able to make the request and get the response just fine when looking in a tool like firebug, but I'm having problems trying to actually access or do anything with the response text. Basically, I have something like this in my ...

How to create a view that is not accessible directly but can only be redirected to?

I'm currently working on the user registration in my project. After the registration is done I wish to show some confirmation to the user. I decided to create another view. That's fine. Now, if after the registration I just return the view like: public class MyController : Controller { [AcceptVerbs (HttpVerbs.Post), ValidateAntiFor...

ASP.NET MVC and jQuery - Problem with ajax encoding

Hi everyone! I'm using this to save some data to DB: $("#btnSave").click(function() { $.ajax({ type: 'POST', contentType: "application/x-www-form-urlencoded; charset=UTF-8", data: 'description=' + oEditor.GetXHTML(), url: '/SuperAdmin/ReceiveData/', success: function()...

How to inject action name into masterpage to highlight current action in nav menu?

I am trying to find a solution (that does not use javascript) to this problem: I have a master page that includes a navigation menu. Each item in that menu is an action. When the user selects that action and goes to that view I want to highlight that item in the nav menu to indicate to the user what they are currently viewing. I could...

asp.net mvc url routing - sub folder name

Hi there I would like to create a url just like followings : http://localhost/news/announcement/index http://localhost/news/health/index http://localhost/news/policy/index announcement, health, policy are controller so I make a new url route map like this : routes.MapRoute( "News", "news/{controller}/{action}/{id}", new { control...

Controller ModelState with ModelStateWrappper

HI, to all, i am use Structure Map to implement dependency-injection. I created ModelStateWrapper class to send Model state in service layer, which in constructor get reference to ModelState of controller. In bootswrapper i registered my type: ForRequestedType<ISourceService>() .TheDefaultIsConcreteType<SourceService>(); For...

ASP.NET MVC, Manipulating URL Structure.

How do I create a custom route handler in ASP.NET MVC? ...

ASP.NET MVC 1.0 AfterBuilding Views fails on TFS Build

I've upgraded from ASP.NET MVC Beta to 1.0 and did the following changes to the MVC project (as descibed in the RC release notes): <Project ...> ... <MvcBuildViews>true</MvcBuildViews> ... <Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(Pro...

Can Hidden element be accessed by javascript getElementByName ?

I have Hidden field like <%= Html.Hidden("ID", 1) %> and in javascript i want a value of that field by var ID = document.getElementsByName("ID").value; I can't access it! is there any other way? ...

Where to put auditing or logging?

I'm currently working on an ASP.NET MVC project using NHibernate and I need to keep track of changes on some entities in order to be able to make some reports and queries over the data. For this reason I wanted to have the data in a table, but I'm trying to decide where to "hook" the auditing code. On the NHibernate layer: PRO: Powerf...

Mobile application download site

Hi, We have a CMS I created and it's working great but now I want to move the download of the mobile binary (installer) files to the CMS. They are currently streamed from another server. The only solution I can see is to have an index of what files are in what folders etc as an Xml document and use Linq2Xml for retrieving the files an...

What is the easy way of implementing Paging in ASP.NET MVC?

Hi Friends, Being new to ASP.NET MVC, I would like to know the easy method of paging. The data is IQueryable type. ...

How can i implement a role-hierarchy in an asp.net mvc app using activedirectorymembershipprovider

In my asp.net mvc app i am using the activedirectorymembershipprovider. In the active directory i have created a couple of roles (groups) similar to, for simplicity of this example, "normal" and "administrator". I am currently querying whether user is in role by getting the IPrincipal of the httpcontext and calling User.IsInRole(nameOfR...

Striped table rows in ASP.NET MVC (without using jQuery or equivalent)

When using an ASP.NET WebForms ListView control to display data in an HTML table I use the following technique in to "stripe" the table rows: <ItemTemplate> <tr class="<%# Container.DisplayIndex % 2 == 0 ? "" : "alternate" %>"> <!-- table cells in here --> </tr> </ItemTemplate> With the following CSS: tr.alternate { ...

Returning a PartialView with both HTML and JavaScript

I am making an AJAX call (with jQuery) to retrieve a PartialView. Along with the HTML I'd like to send back a JSON representation of the object the View is displaying. The crappy way that I've been using is embedding properties as hidden inputs in the HTML, which quickly becomes unwieldy and tightly couples far too much stuff. I could j...

Puzzling behavior of ASP.NET MVC app

I've got a simple search page on my Index view with a dropdown and a text box. I'd like to remember the user's preference for the dropdown, so I store that in a table and retrieve it as needed. Here's the Controller function: Function Index(ByVal lob As String, ByVal filter As String) As ActionResult If If(lob, "") = "" Then ...

Trouble with jQuery MaskMoney plugin and Field type Decimal (SQL SERVER table)

Hi people. I am using a ASP.NET MVC framework, jQuery library (1.3.2), linq to sql, sql server 2005. I have a problem with jQuery MaskMoney plugin, to save data in sql server table. I created a table, where this table have a field "valueProducts" type Decimal(18,2). In my page, I have a html field with jQuery maskmoney. Example: 10.00...

How to mock Controller.User using moq

Hi there, I have a couple of ActionMethods that queries the Controller.User for its role like this Boolean isAdmin = User.IsInRole("admin"); acting conveniently on that condition. I'm starting to make tests for these methods with code like this [TestMethod] public void HomeController_Index_Should_Return_Non_Null_ViewP...

ASP.NET MVC + jqGrid Embedded Links Best Practices

I have a Mvc app that I am replacing some hard rendered tables with jqGrid [XML]. Problem is I have action links in one of my columns to perform certain actions on the rows. I have these duplicated using CDATA tags in my XML; however the problem is that now this tag is generated in an action method so all the HTML is in my controller (...