asp.net-mvc

How can I pass a url as a variable in a querystring to my controller?

I'm trying pass in a url as a paramter to my controller like this: //Passed in via url like this: //http://www.mydomain.com/Puzzle/ContinuePuzzle/{insert url here} public ActionResult ContinuePuzzle(string url) { return View("PuzzleWrapper", (object)_PuzzleService.ContinuePuzzle(url); } Whenever I try this I get...

Unit Test Adapter threw exception: Unable to load one or more... in ASP.NET MVC

Using ASP.NET MVC 1.0 (current) I create a new default ASP.NET MVC project using Visual Studio 2008 on an x64 machine (Server 2008) and accept all the defaults and build and run it. Apart from having to set the System.Web.* assemblies as "Copy Local" it runs and brings up the default web app. When I try and run the unit tests on this pro...

How to i unit test this method?

I need to unit test this method. I'm using moq as my mocking framework, if that helps. [AcceptVerbs(HttpVerbs.Get)] public RedirectToRouteResult LogOff() { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Post"); } cheers :) EDIT: It was mainly the FormsAuthentication i was wondering. Should I even be testing ...

How to combine columns for DatatextFiled of DropdownList?

I have Dropdown list of Faculty Name. In my database they are stored as FirstName, LastName, MiddleName, I want to combine it in dropdownlist ViewData["FacultyID"] = new SelectList(faculty, "ID", "FirstName"); at place of datatextfield. ...

Is it possible to have Html.ActionLink add URL params automatically?

What I'd like is for all urls to contain a certain parameter without having to pass it to the views and add it to ActionLink through the routevalues param. I have a section in my site that I want to keep track of a "return param" for all links. It works fine for forms since Html.BeginForm sets the action to the exact current url already....

ASP.Net MVC or Zend Framework. What is your opinion.

I am looking to start a new project and I am trying to decide which framework to go with. I have been using ASP.Net for a while and enjoy it. My first introduction to web applications was with PHP and I still love it. The project should be a medium sized project maintained by 1 or 2 developers with a potential to grow. The only pros and ...

ASP.NET MVC URL Routing with Multiple Route Values

I am having trouble with Html.ActionLink when I have a route that takes more than one parameter. For example, given the following routes defined in my Global.asax file: routes.MapRoute( "Default", // Route name "{controller}.mvc/{action}/{id}", // URL with pa...

ASP.NET MVC: Namespaces in routes

Hello! I have a small problem, I can't find any documentation on the namespaces parameter for MapRoute. Can anyone explain how I should use that? I want to map ~/Controllers/Projects/ProjectController.cs to this url ~/Projects/ but I also have other controllers in ~/Controllers/Projects that I want to map to other URL's. So I need to a...

ASP.NET MVC AJAX change UpdateTargetId if ModelState is invalid

I use a view with two partial views inside. <div id="matches"> <% foreach (var item in Model) { %> <% Html.RenderPartial("RenderMatchesListRowUserControl", item); %> <% } %> </div> <div id="addMatchFormBox"> <% Html.RenderPartial("AddNewMatchUserControl");%> </div> The first partial view "RenderMatchesListR...

SEO URLs with ASP.NET MVC

Is there a definite DO and DONT when implementing seo urls? A lot of good practise seems fine for .html sites but breaks down on medium/large database sites. AFAIK the url should be www.mysite.com/category/page-name-here If I wish to make a content rich site and be default the category and page are database driven - does this prevent ...

ASP.NET MVC is now "open source". Is this a good thing?

This question is only looking for feedback on the direction of ASP.NET MVC as a platform. I truly am not posting it as flame-bait. My company is planning a major web application investment and we need to decide if ASP.NET MVC is the right direction. === Update Microsoft Answers Scott Guthrie, head of ASP.NET development, posted this o...

ASP.NET MVC - How to access Session data in places other than Controller and Views

We can access session data in controllers and views like this: Session["SessionKey1"] How do you access Session values from a class other than a controller or view? ...

ASP.NET MVC Utilize Test Controller or Test Model

In a new MVC application, I am building out all of the models, controllers, views etc. without my backend DB setup yet. I have an idea of what the backed will look like, but for now I'm focusing on the application. I know that I can mock up a dummy model within the controller like: public ActionResult Pictures() { MyMVCApp.Models....

Dynamic RadEditor Creation through HtmlHelper

I am using the Telerik RadEditor (Q1 2009 SP1) in our ASP.NET MVC (RTM) project. The editor works great when rendered as a hardcoded object on the page with a static id. But when extending with an HtmlHelper to do dynamic creation by passing in an Id it seems to render the html as all lowercase for the tag. Does the HtmlHelper object ...

asp.net mvc and custom membership and role providers

My question, is it possible to build customer membership and role providers (overriding the asp.net providers) when using asp.net mvc? I am guessing it is possible but have not seen any information about it. Would it be done the same way as in asp.net? Just changing the web.config to point to a new provider and then providing the over...

ASP.NET MVC RedirectToAction Passing Wrong Parameter Value?

I am using ASP.NET MVC 1.0. I have an ActionResult which receives a form post with a value from a drop down list. It then redirects to an ActionResult, passing the value as a parameter. Here are my 2 ActionResult methods: [AcceptVerbs(HttpVerbs.Post)] public ActionResult FindPromo() { var promoId = Convert.ToInt32(Request.Form["ddlP...

Routing based on the request uri host

So the basic premise to this problem is that I have a single hosted webspace which came with two domain names. I am unsure how to configure routing in asp.net mvc so that the first thing I would check would be this host in the request object so that I can more user traffic to two separate parts of my website. For example: http://www.my...

Subfolders in controllers and views

Hi, I wanted to have more than one controller and view for same object/model in asp.net mvc, but it turned out to be a little complicated than I expected. Basically what I want to do is something like this : site.com/product -> will show product details to visitors. site.com/admin/product -> will show some extra informatio...

When developing a web app (ASP.NET/MVC) when do you add your security?

When developing a web app, in my case a ASP.NET MVC app, but this question isn't platform specific, when you do you add the infrastructure for membership, roles and authentication? I've actually done it both ways.... 1. Start developing the app with membership/roles/authentication being one of the first milestones and 2. Wait until mos...

ASP.NET MVC - strongly typed view with partial views (view and partial views should also have access to some global data)

Consider the following scenario: Action Edit() is forwarded to Edit.aspx view to render the view. Edit.aspx consists of textbox1 and two partial views (aka view user controls): part1.ascx (which has textbox2, textbox3) and part2.ascx (which has checkbox1 and checkbox2) You want to have a strongly typed view for Edit.aspx, say, you use...