asp.net-mvc

Asp.net Mvc: Creating a simple cms.

Hello, I am trying to build my own CMS for myself and my clients. The system will mainly be used for small websites < 10 pages. For bigger project I will most likely use an existing system(MojoPortals, Umbraco, Kooboo). The reason why I want my own system is so that I have full control and also because existing systems are mostly bloated...

DDD Infrastructure services

Hello, I am learning DDD and I am a little bit lost in Infrastructure layer: As I understand, "all good DDD applications" should have 4 layers: Presentation, Application, Domain and Infrastructure. Database should be accessed using Repositories. Repository interfaces should be in Domain layer and repository implementation - in Infrastru...

How to unit test TimeZones?

Hi I am wondering how to you test TimeZone logic? For me my timezone stuff is used to filter data from the database(what of course in unit tests gets mocked up and not tested). But I would like to test the logic around it to see if I give certain times in that it would be converted right. I am not sure how to do this though. ...

Combining extension methods

I'm trying to write 2 extension methods to handle Enum types. One to use the description attribute to give some better explanation to the enum options and a second method to list the enum options and their description to use in a selectlist or some kind of collection. You can read my code up to now here: <Extension()> _ Public ...

How to simiulate a JSON call from an HTTP GET Call?

At this moment I am calling my index view in one of two ways. Using the normal http view and serializing it JSON. In order to test it I am using the code below, and it works. I want to get it with a http get call. Like (http://localhost/article,json or something similar. Any ideas. $.getJSON("/Article", function(json) { $...

Class Diagram for Asp.net Mvc and C#?

Hi I am looking for a program that can make class diagrams for C#. I know Visual Studios Pro has a class diagram generator but the couple times I used it I found it limiting in the fact you could not tell it where you wanted to generate the class(Ie if I wanted this class to be in the model folder I would have to manually move it their ...

ASP.NET MVC redirection Action to Default?

I have a action on my controller (controller name is 'makemagic') called 'dosomething' that takes a nullable int and then returns the view 'dosomething.aspx'. At least this is what I am trying to do. Seems no matter I get routed to the Default() view. public ActionResult dosomething(int? id) { var model = // business logic here...

How does ASP.NET MVC relate to WCF?

A Guide to Designing and Building RESTful Web Services with WCF 3.5, this article explains the foundations of REST and how it relates to WCF. MVC uses REST as the architectural model. I am guessing one can use the .NET MVC to create web applications that have both a front end and an API point, but I am not sure if the safe way of buildi...

Why is the Edit code in my ASP.NET MVC application not working?

For some reason, the edit action below get to the edit view form fine, but when I hit submit on my view page to post on the second method below, the companyToEdit structure do not contain the companyID and I get an exception. This is weird since, I have done this before and I get the id field in other instances. If I put in the view ...

ASP.NET MVC Forms Authentication + Authorize Attribute + Simple Roles

I'm trying to add simple Authentication and Authorization to an ASP.NET MVC application. I'm just trying to tack on some added functionality to the basic Forms Authentication (due to simplicity and custom database structure) Assuming this is my database structure: User: username password role (ideally some enum. Strings if need b...

Disable links for the current url?

O.K. I think that's an easy one! I have a ViewMasterPage with some links on it (Home/About/Login/ etc). What I want to achieve is simply have the link disabled when it's referral url is already opened (i.e. if the current url is /Register then the Register link should be disabled .. easy hah!?) As I don't like to write a lot of in-line...

Add a trailing slash at the end of each url?

Hello SO Fellows! I have a little problem here. I need to add a trailing slash at the end of each url in the site I'm working on. I defined all the links inside the site to have a trailing slash like so: <a href="/register/">Register</a> While this works fine there's still one tiny issue: it's with the generated urls that come from...

ASP.NET MVC Unit Testing - Sessions

Having searched StackOverflow, and Google I think what I'm doing is suppose to be right, however results don't seem to be going well [TestMethod] public void LoginAction_Should_Return_View_and_User_Authenticated() { // Arrange var mock = new Mock<ControllerContext>(); var mockSession = new Mock<HttpSe...

tagging db with asp.net mvc - controller versus model question

i am using the Toxi solution on this site for tagging bookmarks: http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html In controllers, i have a LinkController class class LinkController ActionResult AddNewLink(FormCollection collection_) ActionResult Index() In Models, i have a LinkRepository: class LinkRepository v...

ASP.NET MVC: set value in other field on my view, how to?

Hi, I have a view where the user can change some settings, its basically a "edit" page. When the user checks a particular value in a radiogroup i set a hidden field (its a invisible input type=text field), but when i load the page i want that hidden field set from my code. How to do this? JQuery? or can i "findControl" somehow? This is ...

Is it possible to create a asp.net mvc web application compatible with ms .net & mono?

I am thinking about creating my new asp.net mvc web application compatible with native ms .net as well as mono (ms server licensing cost compared to linux server licensing cost). DB access was handled by NHibernate. Is it possible? What are the limitations of mono regarding asp.net web applications? Would like to hear about asp.net mvc...

see incoming request from Java app in ASP.NET MVC

Using a Java based image uploader and having problems, seems my controller action is not being hit if I upload multiple files. I can't use fiddler or FireBug because they don't pickup the Java apps request to the server. I need to see what is being requested in debug mode so I can fix my Route - I am assuming this is my problem. How...

Using the ASP Compiler in NAnt to build an ASP .Net MVC application

I am succesfully building ASP .Net applications in NAnt using the ASP Compiler, without a problem., as part of my Continuous Integration process. However, if I try exactly the same process on an ASP .NET MVC application, the build fails in NAnt, but will compile succesfully in Visual Studio. The error message I get in NAnt is: [Htt...

How to do Basecamp-style accounts in Asp.Net Mvc?

For an Asp.Net software as a service application, I want to do account based subdomains like Basecamp and the rest of the 37Signals products have. E.g. acme.myapp.com will load the account for that customer and pull back only their information. This is easy to do in Ruby on Rails, but how would you handle this functionality in ASP.NET ...

What are the security risks of depending on Hidden fields in a webpage to edit db records?

I am currently building a very small/simple web application in ASP.NET MVC with ADO.NET Entity Framework. I hit the wall doing an edit of one record in the database where I had to include the unique id (primary key) inside the html as a hidden field. This was One Possible Solution based on a question I asked here. I am afraid this m...