asp.net-mvc

Asp.net MVC debugging on IIS6

I've setup IIS6 to work with MVC, added a new virtual web site, entry in etc/hosts and everything works except when I try to start project from Visual Studio. I've changed project settings to Local IIS server to url http://myproject and when I try to run project I get Unable to start debugging on the web server. An authentication er...

asp.net mvs ASPNETDB - uploading sql server to hosting site

i have taken the default asp.net mvc template and customized to work for me. I want to now upload this to my hosting provider. how do i get the sql server database into my server. Do i just upload the ASPNETDB.mdf file. What is this file actually? Does it represent the whole database. Can i simply copy that file around to migrate m...

How do I make a mockup of System.Net.Mail MailMessage?

Hi So I have some SMTP stuff in my code and I am trying to unit test that method. So I been trying to Mockup MailMessage but it never seems to work. I think none of the methods are virtual or abstract so I can't use moq to mock it up :(. So I guess I have to do it by hand and that's where I am stuck. *by hand I mean witting the inter...

Page contruction times in ASP.NET MVC and WebForms

I want to display at the bottom of my pages a simple "built in x.yz seconds" text, to easily check various options. (some pages are built using parameters entered in a previous page by a "regular" user, who would like too to see the results of his decisions) I know I can use traces in asp.net, but it's not very user-friendly, and I fear...

How can I pass JavaScript errors from an action to my view?

I have 2 actions, one for GET and the other handles POST requests. Although I have validation on the client side, there are some things I check for on the server-side also (in my action method). In the POST action, when I find errors etc. that I want to report back to the UI, what options do I have to send back messages/errors to the c...

NHibernate unable to pick up new data from the database

Hi all, I am using NHibernate to as the Data Access layer for my ASP.NET MVC application. I am also using Structure Map as an IoC container. I have configured Structre map to create a session factory as a singleton and create sessions on a per request basis (InstanceScope.Hybrid). I am able to do basic CRUD operations just fine. Now, I ...

What is Shared State in an ASP.NET MVC Application?

In a recent Stackoverflow podcast (#59), Jeff Atwood mentions that Stackoverflow has some "shared state." I understand the general idea of shared state, but what exactly is shared state in the context of an ASP.NET MVC application, like Stackoverflow? Specifically, I'd like to know the following: What does it look like? How do you s...

Why in ASP.NET MVC, is there a ContentPlaceHolder for the title?

In a new ASP.NET site there is a ContentPlaceHolder for the title: <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> </head> In the page: <asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat...

How to Troubleshoot ASP.NET MVC

I've just installed ASP.NET MVC on my Vista x64 box, and created a default ASP.NET MVC project with no modifications. When I attempt to browse the application, I simply get the usual useless "Internet Explorer cannot display the webpage" message. I've tried setting a breakpoint in Global.asax, but it's not being hit at all. Cassini seem...

Where should the browser types be segregated in an ASP.NET mobile MVC application?

I am building what will primarily be a mobile browser targeted ASP.NET MVC application. Although it will target the desktop as well in a smaller capacity. (I'm fairly new to both MVC and mobile apps.) I'm wondering what is the best practice for segregating mobile vs. desktop users in an MVC application. Should the controller be in ...

How to architect a mid sized MVC application

I am working on creating an MVC application for an existing Bug tracker of sorts, ASP.net Web site. I am used to passing data in the querysting of a Web site and am not sure how to go about doing that in MVC. I do understand the MVC model and how things work but as a beginner, my thought process is a bit clouded. Views/Project/Index.as...

trying to export tables from aspnetdb.mdf into another sql server

i have a SQL server database on a server. I have just recently been playing around with asp.net mvc and i am using the membership login control. i see that it creates a default local database called aspnetdb.mdf with teh following tables: aspnet_Applications aspnet_membership aspnet_paths aspnet_profiles aspnet_users aspnet_usersinRol...

can i view aspnet.db in sql server 2008 management studio

i have just started playing aorund with asp.net mvc and i want to view the database (aspnetdb.mdf) in sql server 2008 management studio but it doesn't seem to let me view this file. any suggestions? ...

Ajax Security Question: Supplying Available usernames dynamically

I am designing a simple registration form in ASP.net MVC 1.0 I want to allow the username to be validated while the user is typing (as per the related questions linked to below) This is all easy enough. But what are the security implications of such a feature? How do i avoid abuse from people scraping this to determine the list of val...

Non Linq2Sql Model Binding examples in ASP.NET MVC

I notice a lot of the examples for ASP.NET use Linq2Sql as the datasource. Are there any examples out there which show how do use model binding with a non-Linq2Sql datasource, ie a dataset, or (as in my case) a generic list/collection of items based on a custom business object? ie public class WebsiteList : List { public WebsiteLi...

ELMAH and Exception Management in ASP.NET MVC

I am looking at moving away from the Exception Management Application Block in the Enterprise Library for a new ASP.NET MVC site. Scott Hansleman's post(s) on ELMAH has caught my eye but I don't fully understand the approach. Typically I would suppress some exceptions (ones that are recoverable), log them in a central repository, and...

How does NerdDinner's AddModelErrors work?

I'm going through the NerDinner free tutorial http://nerddinnerbook.s3.amazonaws.com/Intro.htm I got to somewhere in Step 5 where it says to make the code cleaner we can create an extension method. I look at the completed code and it has this to use the extension method: catch { ModelState.AddModelErrors(dinner.Get...

asp.net mvc - Route for string or int (i.e. /type/23 or /type/hats)

Hi guys I have the following case where I want to accept the following routs '/type/view/23' or '/type/view/hats' where 23 is the Id for hats. The controller looks something like this: public class TypeController { [AcceptVerbs(HttpVerbs.Get)] public ActionResult View(int id) { ... } } Now if they pass in...

System.ArgumentException: Keyword not supported: 'provider'.

I have a working copy of asp.net mvc site locally. I just uploaded the whole site to my web hosting server. everything looks fine at first but when i login, i get the following error: System.ArgumentException: Keyword not supported: 'provider'. [ArgumentException: Keyword not supported: 'provider'.] System.Data.Common.DbConnection...

Validate complex types with DataAnnotations

I've decided to use Entity Framework for O/R Mapping, and DataAnnotations for validation in my project, and I have now encountered an odd problem when trying to implement this. This is what I've done: I have the following entity type Contact ******* Int32 Id (not null, Entity Key) Name Name (not null) Address Address (not null) Strin...