asp.net-mvc

Add a sitemap provider at runtime in asp.net (MVC framework)

I'm building a regionalized site each region has it own sitemap and own content. The regions can be added at runtime. Is there any way to add a sitemap provider at runtime? I need multiple site map providers at once so that I can leverage the mvcsitemap without to many changes. ...

Best MVC Practices for implementing website search

I have a website that has PageContent, News, Events etc and I have a controller that will handle the search. In that controller action method I guess I do a var results = SearchClass.Search(searchstring) to keep the logic out of the controller. However because I am returning different results because I am searching News, Events etc how...

Problem with DataAnnotations and MVC1: Required attribute is ignoring the ErrorMessage property

I'm validating the properties of a linq to sql entity using DataAnnotations, the properties are validating fine but the Required[ErrorMessage="error message"] ErrorMessage attribute is being ignored and instead I'm getting the default error message. Here's the code I have so far: [DisplayName("Nombre")] [Required( ErrorMessage ...

What is equivalent GetPropValue<T> method in L2E ?

Hi people. I´m have a problem using EF for my data model. I have this code in my method: listaPaginada = sortOrder.Equals("asc") ? _cadastroServ.SelecionaNotasFiscais(idParceiro).OrderBy(i => i.GetType().GetProperty(query)) : _cadastroServ.SelecionaNotasFiscais(idParceiro).OrderByDescending(...

Strongly typed links in ASP.NET MVC 2.0 beta

With ASP.NET MVC 1.0 I always have been able to generate strongly typed links in my Views using a lambda function: Html.BuildUrlFromExpression<TController>(c => c.Action(arg)); I'm now upgrading to ASP.NET MVC 2.0 beta and I can't find any strongly typed extension for the HtmlHelper (nor the UrlHelper in fact). Have they been replaced...

ASP.NET MVC 2 Preview 2 under Mono in Linux

I am actually successfully running a production website with ASP.NET MVC under Mono in a Ubuntu LTS Linux. This server is located somewhere in the cloud and it rocks! Today, I have tried to make it all work with ASP.NET MVC 2 Preview 2, which can be found here: ASP.NET MVC 2 Preview 2 I have downloaded the source code because I wanted ...

Accessing Page URL from within Partial View in MVC

I have a page which has a partial view included within a div called test. I may request more content to be placed within this div by receiving back a PartialViewResult. I want to be able to obtain the url of the page (i.e. what is shown in the address bar) from within the PartialView code but when I use Request.Url, it gives me the URL...

Do MVC helpers encode the Attribute Values?

ie new{@class="Model.Class"} ? ...

build custom control common for both ASP.NET web application and Web form application

Hi all , I have to create a custom control that just renders scripts like object tag and some javascript file path ... and this control is going to use by both MVC and asp.net webform application please advice if this is possible. ...

How do I find out at runtime what area a controller is belong to in asp.net mvc?

Since this stuff is fair new I couldn't figure out any good reference on it. I want to use reflection to enumerate through all the controller in my application. This is not hard using reflection. But since area come into place. How do I know which area (if any) does a particular controller belong to? Maybe I am doing it wrong, maybe I ...

Which is the best MVC v.2 learning source?

I would appreciate some suggestions about useful sources for learning the new features of MVC v.2 Beta . and the real question is how to learn the features of the MVC 2 before release ? ...

What Open Source Software has Quality ASP.NET MVC C# code

I am looking to read other peoples software to learn how to produce quality, speedy, reusable code. If the code has JQuery in it that would be great because I am learning JQuery as well. Thanks ...

Can the MasterPage be designated from the Controller?

I have a couple different userTypes (Admin, User) and a MasterPage for each. I am beginning to create some Views that will be used by both userTypes where i would like to assign the MasterPage programmaticly (based on _currentUser). Possible? thx ...

ASP.NET MVC & Silverlight

Should an ASP.NET MVC Developer start to learn Silverlight either? ...

How to modify request headers in c#,ASP .NET.

I am working on a ASP .NET mVC project & i have to change HttpHeaders. see the foolowing code snippet: WebRequest req= HttpWebRequest.Create("myURL"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); req.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3....

MVC and Umbraco integration

I've followed the steps from http://memoryleak.me.uk/2009/04/umbraco-and-aspnet-mvc.html and integrated MVC in Umbraco with success, but i still have a problem which is critical for me. Is there any way to inherit the Umbraco defined templates in a MVC view? As I understand the problem is that the Umbraco templates become html only at ru...

HttpContext.User or Page.User in a View?

If I'm coding in a View in Asp.net MVC and I want to get the current user, is it better to use Page.User or HttpContext.User Is there a difference? ...

Controller Passing User Info, or use HttpContext.User?

I recently asked a question about using the Page.User or HttpContext.Current.User in the View. It was recommended I pass the user info through the Controller instead? I've seen this in other posted answer as well. Why is it recommended to pass the user info through the controller and not use Page.User or HttpContext.User? ...

Passing Data from Controller to View to back to Controller to back to View

I'm new to ASP.NET MVC. After working with traditional ASP.NET model for so long, it's taking some time for me to get to understand this model. I am going through NerdDinner to understand how things work. So, I have an object that needs to be passed through couple of views. Similar to the article NerdDinner Step 6: ViewData and ViewM...

If I implement my own CustomPrincipal in asp.net mvc, must I use a Custom ActionFilterAttribute?

If I implement my own CustomPrincipal in asp.net mvc, must I use a Custom ActionFilterAttribute to check for Roles that my users belong to (like this: http://www.codethinked.com/post/2008/04/01/Setting-up-authentication-in-aspnet-MVC.aspx)???. When I use: [Authorize] It works fine. But when I use: [Authorize(Roles=("Example"))] It...