asp.net-mvc-2

Absolutely different parameters in CreateUser method in my implemented MembershipProvider.

Now i'm trying to do registration/authorization by my own (ASP.NET MVC). I've already implemented RoleProvider class and ValidateUser from MembershipProvider class. Now i'm trying to implement CreateUser, but i don't want to use original parameters, because i got my own. It's possible somehow to not use original parameters or create my o...

Why cant I use LINQ in my views?

The model being passed to my view is of type tblUser - so I expected that I would be able to: <% Model.tblLogins.Where(l => l.date > DateTime.Now.AddDays(-7)).Count() %> However, the .Where() part is not available as an option? I have the following in my web.config but hasnt helped: <add namespace="System.Linq"/> <add namespa...

ASP.NET MVC 2 - Set ViewData on every request in specific area (without inheritance)

In the "Admin" area of my application, an object must be available in ViewData on every page (for display in the Master template). I have already inherited from Controller, so I cannot make a simple base class that handles it. What is a good solution of doing this when not using inheritance? An ActionFilter seems interesting but I don't ...

How do I obtain value from <form> tag?

Based on my co-worker's code, he is passing HTML attributes into his form declaration in the view using BeginForm and the resulting HTML looks like: <form action="/Reviewer/Complete" ipbID="16743" method="post"> How can I obtain the ipbID in my Controller code? I've trying HttpContext.Request.QueryString["ipbID"] ... and ... Req...

web application architecture

I have two projects (Project A and Project B), these projects are hosted in different locations and on different servers. Project B want to access the files of Project A. Can any one suggest me which technique is required to fulfill my requirements. ...

How do I manage NHibernate and Asp.NET MVC ConnectionStrings for seperate projects

I would like to get opinion on the best way to manage the following please. I have an MVC application project, as well as a DomainModel project. The NHibernate mappings and hibernate.cfg.xml are in the DomainModel project which is referenced in the MVC application. This would normally work fine as all my dataaccess would go through the N...

How do I force users to not skip pages via url input in an asp.net mvc 2 application?

I'm using ASP.NET MVC 2 & VS 2008 Pro. I am building a web site where users must go from page A to page B to page C. In other words, the order is very important. I want to guard against a user on page A simply entering a url for page C. If the user attempted to do such a thing I'd like to redirect them back to the page they were on befo...

ASP.NET MVC Routing for files with muliple sub-directories

I need to setup a file handler to route with multiple sub directories something like tihs; http://localhost/images/7/99/786936215595.jpg I tried putting this in the global.asax file; routes.Add( "ImageRoute", new Route("covers/{filepath}/{filename}", new ImageRouteHandler())); I am using the ImageHandler found in this Que...

A class with string file extensions, how to do this?

Hi. I'm want to do a class with file extensions, I thought the extensions should be strings. My problem is I'm not sure how to do this class? I want it to be kinda static so I don't have to declare it like new. I would appreciate any help I can get on this, it's often I find myself in situations where I would need a class like this. EDI...

Fixture.CreateAnonymous method kills test runner process with an error (AutoFixture) when using AutoMoq to create a Controller

I'm trying to use the AutoMoqCustomization with AutoFixture to create an ASP.NET MVC2 Controller in a unit test via the Fixture.CreateAnonymous method. I've tried in both xUnit under TestDriven.NET, the xUnit test GUI and in MSTest and all have the same result: a massive failure of the process running the test. On Windows 7 x64 if that...

mvc2 ajax url fragments

What is the common practice in mvc2 regarding url fragments? When the page is ajaxed, how to save the state in url so it can be bookmarked easily? ...

how to set default actions in mvc

if i have the following Url.Action("Index", "Settings"); How do ensure that the url is alway "Settings/Index" and not "Settings" ...

Render *.aspx within an MVC IView.Render() method

I want to render an *.aspx instead of an *.ascx namespace GenericMVCPlatform.Generics { public class PlatformView : IView { public void Render(ViewContext viewContext, System.IO.TextWriter writer) { // Here I would like to render an *.aspx instead of a *.ascx } private static MvcHtml...

Sample Implementation for System.Web.Mvc.IView.Render()?

Is there a sample implementation for System.Web.Mvc.IView.Render() that I could use as a template? ...

saving state in url on ajaxed page

I need to implement a page with both search form with a search button and grid that displays results ( sortable and pagable ). Lets call this page the summary page. Whole page needs to be ajaxified so it won't reload itself when user is searching or paging or sorting the results. I've got two questions : 1) what is the best way to sav...

Passing and returing data to a simple grid form using ASP.NET MVC

Hi I have page with a simple table and advanced search form. I pass List<Customers> to the model: View(List<Customers>); So what is best way to pass and return data to the search form? I want to use validation or something but I think passing data through ViewData is not good idea. Any suggestions? ...

MVC2 binding data to view model super slow when using JSON and collections.

I followed the http://haacked.com/archive/2010/04/15/sending-json-to-an-asp-net-mvc-action-method-argument.aspx blog on how to setup binding json data to a ViewModel. seems to work. The problem is that it is super slow. A collection with 200 entries in it and 8 fields per entry takes 3 minutes to even reach a break point at the beginni...

Better way to do this..?

I don't think this should be in my view, but instead handled by the controller. I suppose this could be done in the SQL (can get ugly real quick) or in the controller (I think this might be best), or maybe even an HTML helper. But, I'm not sure how to unpack/repack my IQueryable/IEnumberable in the controller. I think that giving the tem...

Passing and receiving routedictionary values in mvc2

I have a link in my action like this <%: Html.ActionLink("View Data","Index","MyItem", new {itemId=Model.itemId}, null)%> now in my newItem controller in its index action how do I retrieve this itemId, so far I have tried this public ActionResult Index() { RouteData rd = this.RouteData; var list = from...

ASP .NET MVC VirtualPathProvider

I am writing a VirtualPathProvider to dynamically load my MVC views, which are located in a different directory. I successfully intercept the call before MVC (in FileExists), but in my VirtualPathProvider, I get the raw, pre-routed url like: ~/Apps/Administration/Account/LogOn Personally, I know that MVC will look for ~/Apps/Adminis...