asp.net-mvc

Returning a 301 Redirect from a Controller Action

On ASP.net MVC, what is the "correct" way to have a controller return a 301 Redirect to an external site? The various RedirectTo-Function seem to only return either relative links or routes that i have mapped manually, but there is no way to say "Perform a 301 Redirect to http://example.com". I think I could just set Response.StatusCod...

How can I create a friendly URL in ASP.NET MVC?

How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this: http://site/catalogue/BrowseByStyleLevel/1 The 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way StackOverflow does it. For example, these two URLs will take yo...

Dynamically assigning master pages using MVC

When using webforms the appropriate place to assign master pages to a page dynamically seems to be the pages PreInit event: this.Master.MasterPageFile = "~/leaf.Master" If nessasary, master pages in a hierarchy of nested master pages may be set here too: this.Master.MasterPageFile = "~/leaf.Master" this.Master.Master.MasterPageFile ...

Strongly typed actionlink with asp.net mvc beta?

I used to be able to do the following in Preview 3 <%=Html.BuildUrlFromExpression<AController>(c => c.AnAction(par1, par2)%> How am I supposed to create urls in a strongly typed way with the MVC Beta? The only thing so far I have found is <%= Html.ActionLink("aName", "ActionName", "ControllerName")%> This is not strongly typed off...

When creating forms, are fieldsets a viable option anymore?

I'm creating a few web forms that have areas to them. Are fieldsets viable options for sectioning forms anymore? Should I just use a div with styles to be similar? ...

What is the right info to cache? What's a good page load time?

I'm in the process of developing a social network site. And been thinking of scalability from day one of the project, I've fine tuned the site and queries to the best of my ability. However; Certain pages are very data heavy and I'm not quite sure if they are loading as fast as they could so I was thinking of implementing a distributed...

Defining a catch-all route for an MVC site

Scenario: A news site with article tagged in categories. My Controller is called "Category" and this URL : http://mysite.com/Category/Sport passes "Sport" to action "Index" in controller "Category" What I want to do is allow URLs like : http://mysite.com/Sport/Hockey http://mysite.com/Sport/Football http://mysite.com/Science/Evolutio...

MVC Framework Use or not for new development

For a new product(A web based high performance application) is it a good idea to use MVC framework instead of traditional development in .net. I have not used it before. Which is better in long run. I know MVC has benefits like unit testing etc but any thing else I should consider? ...

Where to put a simple Class in an MVC project?

Ok, this is possibly borderline-subjective, but I wonder where one would put a simple class that does something within an ASP.net MVC project? I mean a class like the Base36 De/Encoder, that is neither Model nor Controller. Should this always go into a separate Class Library Assembly, or do such Classes have a place within the MVC Web Ap...

How to handle checkboxes in ASP.NET MVC forms?

This seems a bit bizarre to me, but as far as I can tell, this is how you do it. I have a collection of objects, and I want users to select one or more of them. This says to me "form with checkboxes." My objects don't have any concept of "selected" (they're rudimentary POCO's formed by deserializing a wcf call). So, I do the followin...

Disable layout in ASP.NET MVC?

In MonoRail you can just CancelLayout() to not render the layout. In ASP.NET MVC, the only way to affect the layout seems to be to pass the layout name into the View() method like View("myview", "mylayout"); only it seems that passing null or an empty string doesn't do what I'd want. I ended up creating an empty layout that just render...

How do you implement a "Logout" link using ASP.NET MVC?

This seems like a pretty stupid question, but I'm trying to figure out the best way to do this. Would you simply redirect to a /Logout page and have the controller call the FormsAuthentication.SignOut function? That was my first thought, but then I wondered if it could be abused by third party websites. Let's say someone just decides ...

RESTful Web Services with ASP.NET MVC

Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it? ...

ASP.NET MVC ready for business applications (integrating 3rd party controls/components)?

My company has developed (and still continues to develope) a large ASP.NET business application. Our platform is ASP.NET 2.0 using some ASP.NET Ajax. We're extensively using third-party components, like webgrids, comboboxes, treeviews, calendar and scheduling controls etc. Now, I don't know a lot of ASP.NET MVC and I'd like to know if t...

ASP.NET MVC CTP (first version) fails uninstalling

The offending command that msi executes is: .\devenv.com /command "View.Toolbox" /setup This fails with Date execution prevention error. devenv.exe log contains a bunch of errors like this: <entry> <record>120</record> <time>2008/10/21 12:32:01.277</time> <type>Warning</type> <source>Microsoft Visual Studio Appid S...

VirtualPathProvider with ASP.Net MVC

I have implemented VirtualPathProvider class so I can keep all my views in the database instead of FileSystem of web server. It seems MVC requests aspx page correctly from Database, but unable to request related codebehind .cs files and throws error as unable to load the code-behind class file. This virtuslPathProvider works like charm...

Is there a performance difference between asp.net mvc and web forms?

I know there is a learning curve, but what about performance? It seems to me that web forms would be less performant, but I havent tried MVC yet to know for sure. What is everyone else experiencing? ...

ASP.NET MVC: PathInfo Limit?

One of the limitations of ASP.NET 2.0 was that PathInfo was limited to 255 characters. Is that limit a problem in ASP.NET MVC urls, or is there any sort of length limit with ASP.NET MVC routing urls? ...

Asp.Net MVC Beta: Previous RouteData overrides current RouteData?

I have something similar to the following method: public ActionResult Details(int id) { var viewData = new DetailsViewData { Booth = BoothRepository.Find(id), Category = ItemType.HotBuy }; return View(viewData); } and the following Route: routes.MapRoute("shows","sh...

IEnumerable<string> to SelectList, no value is selected

I have something like the following in an ASP.NET MVC application: IEnumerable<string> list = GetTheValues(); var selectList = new SelectList(list, "SelectedValue"); And even thought the selected value is defined, it is not being selected on the view. I have this feeling I'm missing something here, so if anyone can put me out my mise...