asp.net-mvc

asp:calendar not work correctly in MVC

I have an asp:calendar on my view page and as I hover over it..it shows a javascript postback status bar. but I have an asp:button also on the same page and when I hover over it. The action from the controller is in the status bar..because I have an onClick attribute for the button that triggers an action on the server side. and in the ...

ASP.NET MVC controller unit testing boggle

I've been going through the various tutorials regarding the right way to unit test controller logic. Take the following action: public ActionResult Login() { //Return the index view if we're still here return View(); } Word on the street is to wire up a test method similar to this: [TestMethod] pub...

Best practices to test Asp.net MVC applications

Whats the best practice to test an Asp.net MVC application? ...

Mocking Database call Asp.net MVC application

How can I mock the database calls to make my application logic been tested without database? ...

ASP.NET MVC Upgrade to Beta: IControllerFactory is defined in an assembly that is not referenced

Hi, I'm currently in the process of updating a site from preview 2 of ASP.NET MVC to the Beta release. I'm down to my last compile error with no solution in site after an exhaustive search. I have some code in Global.asax.cs which sets up IOC using the Windsor container: ControllerBuilder.Current.SetControllerFactory(typeof(WindsorContr...

Oxite or S#arp Architecture for new Asp.net CMS site

I'd like to build a CMS site based on Asp.Net Mvc and I want to choose my starting point. I have seen that there is a lot of interest in the new Microsoft Oxite project also if it seems to be pretty early to adopt it in a production project. I've also looked at S#arp Architecture but it does not properly compare to Oxite as is just a st...

Is there a way to set Tab Order in ASP.net?

I am trying to set up my tab order on the html side of my project. How do I set the tab order. Usually in visual basic, the option is in the menu bar under view/tab Order. How do I do this in asp? ...

ASP.NET MVC: Controller ViewData & ViewPage ViewData

Hello, I seem to be unable to find the "link" between a controller's ViewData collection and a ViewPage's ViewData collection. Can anyone point me to where in the MVC framework a controlle's ViewData collection is transferred to a ViewPage's ViewData collection? I have spent quite a lot of time using Reflector to try and work this one ...

How do I make sure that there is one NHibernate ISession per request using Autofac?

I have the following code in an Autofac Module that is used in my Application_Start method: builder.Register(c => new Configuration().Configure().BuildSessionFactory()) .SingletonScoped(); builder.Register(c => c.Resolve<ISessionFactory>().OpenSession()) .HttpRequestScoped(); builder.Register<NHibernateSomethingRepository>().As...

ASP.Net MVC: How to dynamically generate a meta tag based on the content of the url?

Here is the idea: When the user wants to see /controller/action, then I want the page to have a "robots" meta tag with its value set to "all". When the user wants to see /controller/action?sort=hot&page=2 (i.e. it has a query string), then I want the page to have a "robots" meta tag with its value set to "noindex". Of course this is jus...

ASP.NET MVC Caching vary by controller action parameter

Is there any way I can vary caching by a controller action parameter using the outputcache attribute? We have varybyparam which will not work if my parameters are embedded within the url in a REST manner. Thanks ...

ASP.NET MVC vs WebForms for First Page Load Speed for Big Projects

We have a pretty big ASP.NET WebForm (web application) project with a lot of references to other libraries, other projects etc and most of the time after a compilation, the first time we load a page it takes a LONG time before rendering anything... Disk IO is the main problem. For small projects it's nearly instantaneous, but once your...

ASP.NET, Ninject and MVC: Performance Load problems

problem description: This model works fine with one user at a time. As soon as I get multiple users at once, I get a serious of errors relating to not closing my SqlDataReader. When i turn off lazy loading like this: persistenceModel.Conventions.OneToManyConvention = (prop => prop.SetAttribute("lazy", "false")); It's fine, yet perfo...

ASP.NET MVC - Current Action

I wanted to set a css class in my master page depending on the current controller and action. I can get to the current controller via ViewContext.Controller.GetType().Name, but how do I get the current action? (ie Index, Show etc) ...

How can I get the route name in controller in ASP.NET MVC?

ASP.NET MVC routes have names when mapped: routes.MapRoute( "Debug", // Route name -- how can I use this later???? "debug/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = string.Empty } ); Is there a way to get the route name, e.g. "Debug" in the above example? I'd like to access it in the controller's...

Url Form Action Without ViewContext

Is it possible to get a URL from an action without knowing ViewContext (e.g., in a controller)? Something like this: LinkBuilder.BuildUrlFromExpression(ViewContext context, Expression<Action<T>> action) ...but using Controller.RouteData instead of ViewContext. I seem to have metal block on this. ...

How do I get over my fears of <% %> in my ASP.Net MVC markup?

So I totally buy into the basic tenents of ASP.NET, testability, SoC, HTML control...it's awesome. However being new to it I have a huge hang up with the markup. I know it comes from my hatred of classic ASP, and I can't help but feel like I've entered the twilight zone when I see this. I don't know what the alternative is (can I use ...

MVC - Output HTML from code, better to use Response.OutputStream or StringBuilder

I'm writing a asp.net MVC site and I have written some extensions to the Html class to generate some html for me. From within the extension method is it better to write directly to the Response.Output stream or have the extension method return a string? What are the advantages / disadvantages of using the Reponse.Output stream directl...

NHibernate session management in ASP.NET MVC

I am currently playing around with the HybridSessionBuilder class found on Jeffrey Palermo's blog post: http://jeffreypalermo.com/blog/use-this-nhibernate-wrapper-to-keep-your-repository-classes-simple/ Using this class, my repository looks like this: public class UserRepository : IUserRepository { private readonly ISessionBuilder...

ASP.NET MVC on GoDaddy Not Working (Not Primary Domain Deployment)

I am trying to get ASP.NET MVC working on GoDaddy and I'm not having much luck. I have read the post on SO that covers the subject, but I must have a slightly different configuration or must be missing somehting along the way because the main MVC page comes up, but all links seem to fail and no amount of tweaking the URLs seems to get i...