asp.net-mvc

Serving different pages as different Domain Names in IIS (6 or 7)

Hi, I have a ASP.Net MVC application which serves user pages with URL like - www.myapp.com/user/rob/index, www.myapp.com/user/rob/article/1 and www.myapp.com/user/scott/index, www.myapp.com/user/scott/article/1 now I want this one application to serve pages to two different domains from outside. Like - www.RobWebSite.com/Index ww...

Blank Asp.net MVC template

Hi Is there a way I can get a blank MVC template for VS2008? Like the only that comes with MVC is nice to see what MVC is all about but it gets annoying when you want to make your own site and you first have to delete all the crap they generated for you. Like I want to use my own authentication stuff since I understand what is going on...

Is recursively rendering a Partial View in Asp.Net Mvc a bad idea?

I want to output a menu structure that will look like this <ul> <li> MenuItemName1 <ul> <li>Child Item</li> </ul> </li> <li> MenuItemName2 </li> </ul> I have a menuitem class that contains the name, url and children menu items. I would like to create a partial view that renders each item as ...

Is there a guide for web.config settings?

Hi is there a guide or tutorial or some kind of reference to learn how to work with asp/net mvc web.config file? ...

store PDF file in DB as byte

Hi: I am using Asp.Net MVC. in my project while uploading PDF file we convert the PDF file into byte then store it in DB. but i got the following exception. " String or binary data would be truncated. The statement has been terminated." Can any one solve this issue.I got the exception righ here context.SubmitChanges(); Tha...

Master pages missing from Web Deployment Project output

We seem to be having an issue when running our deployment project in that, when it compiles, it seems to miss our master pages from the output. Is there any way to 'force' the project to include .master files, either through editing the .wdproj file, or via another method? Also, I've been reading up on the MSBuildTasks community projec...

How to Unit Test Asp.net Membership?

Hi I am new to unit testing and I am trying to test some of my .Net membership stuff I been writing. So I am trying to check my VerifyUser method that checks if the users credentials are valid or not. So this is what it looks like: public bool VerifyUser(string userName, string password) { bool valid = Membership.Validat...

Is Subsonic 3.0 safe for production use?

I'm interested in using Subsonic 3.0 for developing a new ASP.Net MVC application that will be going into production use soon. Would this be a feasible option? Does anyone have an idea when 3.0 is going to be released? Is anyone else using it on a production MVC application? ...

Problem with Url.Content in ASP.NET MVC

For some reason, I am getting a runtime exception when I try to use Page.ResolveURL or Url.Content within the default masterpage (Site.Master) in my newly created asp.net mvc application. This is very odd, because I have been using the ResolveURL helper function in .NET for years without issue. Here is my code snippet: <link href="<%= U...

How should I structure my ViewModel for this hierarchical data I need to display in ASP.NET MVC?

I have a view that will look like this: I'm trying to figure out how I should represent my ViewModel for this view. Each "Agency" can have multiple "Business Units" and each "Business Unit" can have several "Clients". In the database I easily represent this with a mapping table and foreign keys for the Agency, BusinessUnit and Clien...

Entity framework primary keys in Views

I have to use a View with the EF but, when e import it, the primary key of the view is displayed incorrectly and for some reason I can't change it. ...

ASP.NET MVC Dynamic Routes and Action Links with Arbitrary Depth

I'd like to put together a forum/message board with ASP.NET MVC. Pretty common on these types of forums are hierarchical board categories, so for instance: -General Discussion -Technical Support --Website Technical support --Product Technical Support ---Product A Technical Support ---Product B Technical Support Below each category are...

ASP.Net MVC Data Formatting

Say I have a database table like the following: FileID | FileName | FileSize | Group ------------------------------------- 1 test.txt 100 Group1 2 test2.txt 100 Group1 3 test3.txt 100 Group2 What would be the best way to display this data with an MVC view in the style of: Group 1 Table C...

ASP.NET winforms-like philosophy and page lifecycle often get in my way

MVC + classic webforms in the same website Now I am wondering if it was possible to mix MVC and classic webforms (I don't want to reimplement what I've already done even if this makes the code non-homogeneous...) Original question The more I improve my understanding of ASP.NET (and web programming in general) the more I dislike ASP.N...

What would this Moq code look like in RhinoMocks

Hey people... trying to get my mocking sorted with asp.net MVC. I've found this example on the net using Moq, basically I'm understanding it to say: when ApplyAppPathModifier is called, return the value that was passed to it. I cant figure out how to do this in Rhino Mocks, any thoughts? var response = new Mock<HttpResponseBase>(); re...

How can I get uploaded file full path in C# 3.0?

Hi everyone! In my ASP.NET MVC website, I have to read a txt file with some names and emails separeted by ';'. After that, I have to save each line of this txt file to database. Googling around, I've found some snippets, but in all of them I have to use the txt file path. But, how can I get this path? This file could be anywhere in a ...

Can I route a url for a web service (ASMX) in an ASP.NET MVC Site?

I have seen how you can add custom routes to WebForms by using some code like this. public class WebFormsRouteHandler : IRouteHandler { public string VirtualPath { get; set; } public IHttpHandler GetHttpHandler(RequestContext requestContext) { // Compiles ASPX (if needed) and instantiates the web form return...

Implementing IDataErrorInfo with SubSonic 2.2

Hi, I am moving 1 project, just the data tier, the project is using MVC 1.0 and acess mdb :S Now I am moving to SubSonic + Sql server and all is fine, except when I try to implement to my class IDataErrorInfo for validation messages, I get always 2 times every error message I have a table class generated by subsonic:MyTable, then I ext...

Must ASP.NET MVC Controller Methods Return ActionResult?

Being new to ASP.NET MVC, I've been wondering about the signature of Controller methods. In all the examples I've seen, they always seem to return ActionResult, even if they actually return a ViewResult instance or similar. Here's a commonly seen example: public ActionResult Index() { return this.View(); } In such a case, wouldn'...

ASP.Net MVC routing strategy

I've been playing with ASP.Net MVC for a while now. I found the most difficult thing to get right is the routing table. I found most examples leave the default route in place. I found that this leads to a lot of errors where the default route redirects to HomeController with an action that doesnt exist. Leading to strange error messages...