asp.net-mvc

IIS 7 can't connect to SQLServer 2008

Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I get the following classical error: A network-related or instance-specific error occurred while establishing a connection to SQL Serv...

Where should my models live? Web tier or Data tier? (MVC + NHibernate)

I am setting up an n-tier application with MVC, Ninject, and NHibernate (my first using these technologies). For clarity's sake, the tiers are a "Data" tier, a "Services" tier, and a "Web" tier (all are separate projects). With MVC, you have your models that are in the "Models" folder. It seems necessary to put my models here to create...

asp.net mvc user permissions and views

it seems there are 2 options when dealing with security permissions for views in mvc: either handle the permissions control logic in the controller and direct the user to the appropriate view... Or implement some form of security-aware HtmlHelper extensions that render (or not) appropriate form fields/data am i missing any other op...

ASP.NET MVC Navigation and User Interface design

Short Version: Do you know of any way to get an input button (submit) and an anchor tag to render the same visually using CSS and no Javascript? Long Version: I'm developing an ASP.NET MVC application. The site contains pages to view the details of or to create or update my models. The page actions are contained at the bottom of...

Asp.Net MVC Url.RouteUrl Problem on Windows 2003 vs. Visual Studio 2008

I'm seeing a difference in the output from Url.RouteUrl between my development machine and my deployment server. I'm running Visual Studio 2008 and my deployment box is Windows 2003 Server. I have configured the Global.asax.cs to run with the .aspx extension in my routing tables. However, when I use the "Search-Basic" named route, there ...

Actionlink in MVC RC/Beta from codeplex preview 5

In Preview 5, here are the actionlinks that worked fine: listing is the controller and about is the action <%= Html.ActionLink("About", "About", "Listing" ) %> 2. var values = new RouteValueDictionary(); text and actionname are both strings Html.ActionLink(text, actionName, values); What would I con...

I have no style in my asp.net mvc application after upgrading to mvc rc

I am very confused because I am using iis7 integrated and so I should not need default.aspx in my project. However, after upgrading to rc at run time there is no style anywhere in my site. Here is my link to the style sheet that lives along side the master page. At design time, vs is able to pick up the style sheet so I have no idea what...

Problem restricting anonymous access to an ASP.Net MVC Site.

Whenever I restrict anonymous access in my MVC site I get a 404 error: Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the followin...

How do you turn off or replace the default ModelState error message in Asp.net MVC?

I have a controller action which has a nullable DateTime as one of the parameters which comes from a textbox on my form. I noticed that if the user were to type in "blah" in that textbox then I will get a Null value back for the DateTime param and a model error is automatically added. In this case the ModelState error that is added is "T...

Performance vs Quality of Code

Do you think it's worth trading off some performance for code-quality and maintainability? I remember a post by Jeff Atwood that stated that hardware is cheap, developers are not. I think I'd like to change that to "Hardware is cheap, time is not." I've noticed with an MVC project I've been working on lately that sometimes I lose DAYS...

Looking for sample global.asax.cs files for routing information.

No matter what you read about ASP.NET routing or REST I think the best way to learn more about them is to read other people's routing files. In a video with Jeff once you could catch a glimpse of the stackoverflow routing file if you paused the video in the right place. I actually learnt quite a lot just looking at how it was organized. ...

Is there a 'sociable' type plugin for ASP.NET (preferably MVC)?

Wordpress has its popular 'Sociable' plugin which lets you choose from all the popular sites such as digg, stumbleupon, del.icio.us etc. and then gives you a little list of thumbnails. I'm wondering if there is an equivalent 'plug-in' for ASP.NET - preferably something that can easily be made into an MVC Html helper extension method. I...

Anyone using GoDaddy Grid Hosting with ASP.NET MVC?

I very recently released my ASP.NET MVC based website. I'm beginning planning for when I need to upgrade hosting. I'd like to move to a cloud computing provider and I saw that GoDaddy has a grid hosting solution in beta. Anyone tried to deploy an ASP.NET MVC web app to the GoDaddy grid hosting? If so, how was the experience? According t...

Get filter redirect to action?

RedirectToAction is protected, and we can use it only inside actions. But if I want to Redirect in Filter? public class IsGuestAttribute: ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { if (!Ctx.User.IsGuest) filterContext.Result = (filterContext.Controller as Contro...

List of HTML Helpers you use

I have found Html Helpers extremely useful to simplify view pages code. Apart from the ones included in the latest release of Asp.Net Mvc which one do you use? How much you can reuse them in different projects and are they linked only to html generation or did you put some custom logic inside? ...

asp.net mvc - need to store some data for the current request

I am writing a user authentication class. During the request there are a lot of references to the current user, so I would like to cache it in memory instead of calling the database ala singleton. I am thinking about using session and clearing it at the end of every request. like: public static User Current() { if (Session["curr...

ASP.Net Entity Framework

I'm just trying the ASP.Net Entity framework its the first time I've tried to use an ORM framework so bear with me If I'm barking up the wrong tree. To simplify the problem I've got the following 2 tables Calendar CalendarID UserID Date EventName Users UserId Username I've added them both to my Entity Framework model and its establ...

How to speed up Google adsense and analytics loading time?

This might fall under the category of "you can't", but I thought it might be prudent to at least see if there is something I can do about this. According to FireBug, the major bottleneck in my page loading times seems to be a gap between the loading of the html and the loading of Google adsense and analytics. Notice in the screenshot b...

What exactly does the "Over" Clause in T-Sql do?

I'm starting to mess with ASP.NET MVC and came across the issue of wanting to do some basic Paging. So I used this simple Linq statement (using the Northwind Database) to get 10 items for a specific page: var q = (from p in db.Orders orderby p.OrderDate descending select p).Skip(currentPage * pa...

Anybody written a tool for static analysis of an ASP.NET MVC application?

Has anyone written a tool to do static analysis of an ASP.NET MVC application? Disclaimer: I'm not sure what I want really is static analysis - it just was the closest term I could come up with. What I'd like is to get a tabulated list of all my controllers, my actions, show whether they respond to GET or POST, what their cache setting...