asp.net-mvc

How to develpo the web based application that can be viewed on the mobile phone in asp.net(vs2008)

sir I am the beginner of the asp.net,for my current project i need to develop a mobile web application using asp.net 3.5 that can be viewed on an Phone and all other browser what to support it, but there is no longer a template in VS2008 to enable mobile development. please give some more idea about that sir,Thank you. ...

How to unit test full text search in ASP.NET MVC

I've just started out using ASP.NET MVC and TDD. I've read that while unit testing you should focus on testing your code, not other systems, like the DB. However, what happens when essential functionality is residing in the DB? I've used the MVC Storefront series as an initial guide in how to set up my projects and patterns. As full tex...

Why isn't AntiForgeryToken included in every form by default?

I am interested why isn't AntiForgeryToken included in every ASP.NET MVC form by default? It seems the pluses of always including it outweigh the possible disadvantages. And this behaviour could be disabled in case of need like for Web Forms HttpRequestValidationException. ...

Problem when using Entity Framework in ASP.NET MVC

I use Entities Framework to implement my data accsee layer in ASP.NET MVC. I got a problem in View. When my code in the VIEW something like: <%= Model.FirstName %> I got an error in run time: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web re...

How to get checkboxes from FormCollection?

I am using asp.net MVC. I have strong type view (List) of some table e.g. Index method now I put four checkboxes for each row, Like Now I submit the form. In controller there is method called [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(FormCollection result) Question : What would be the name and id property of e...

ASP.NET MVC How to apply role-based or authentication-based View rendering?

Hi, i want to show/hide certain parts of a View based on Authentication-status or Roles. For my controller actions I have extended ActionFilterAttribute so I can attribute certain Actions. <RequiresRole(Role:="Admin")> _ Function Action() as ActionResult Return View() End Function Is there a similar way (attributing) which I ca...

WCF Sorting and filtring

Im doing a proof of concept on wcf and mvc. And I got some questions: Is there already a built-in solution for handling sorting/filtring in WCF? Or do i have to do somthing like this, optional sorting class: [OperationContract] Invoice GetInvoices(SortingClass criteria); Is there a build-in solution for lazyloading in WCF, or use...

Ajax Forms in ASP.NET MVC

I have a form that collects a data using ASP.NET MVC. It looks like this: [AcceptVerbs(HttpVerbs.Post)] [AutoValidate] public ActionResult Contact(ContactMessage msg) { if(ModelState.IsValid) { try { this.messengerService.SendMail(msg); RedirectToAction("Index"); ...

Why does ASP.NET MVC have to be a web application?

I'm wondering if anyone has any insight into why ASP.NET MVC sites have to be created as a web application (compiles to single .dll) in Visual Studio as opposed to a web site (each page is a .dll)? I suspect that it has something to do with the routing. Any thoughts? ...

Localization in ASP.NET MVC

Visual Studio 2008 I want to bring some localisation into my ASP.NET MVC site. Someone suggested creating a resource file "Strings.resx" as a publically strongly typed resource, which works nicely and allows me to write <title><%= Strings.MyView_Title %></title> I then proceeded to add a file "Strings.da.resx". This file is created ...

ASP.NET MVC How-to use routes when application is published as SubProject of a domain?

Hi, i have a webapp which works perfectly when debugged and tested locally. However when I publish the site to a productionserver the routing is messed up. This is because it runs as a sub-project on the productionserver. Testing: http://localhost:xxx/ Production: http://remotehost/webapp/ How should I setup routing? This is m...

Does resharper have problems with asp.net mvc?

I'm using the latest release of resharper. Just downloaded and installed last week so I'm new to using it. The problem I'm having is that in my ASP.NET MVC application all of my controllers say they are never used and all the methods within the controller say they are never used. Is there a way to suppress the messages or for resharpe...

Extending the DataAnnotations attributes for MVC in asp.net

Brad Willson has a great article on descripting how to use DataAnnotations. http://bradwilson.typepad.com/blog/2009/04/dataannotations-and-aspnet-mvc.html What I would like to do is extend the available attributes that I can use. Something like [ PastDate(you must enter a date in the past)] or [InvoiceNumber( all invoices start with ...

Issue with Default and catchall routes

I define a lot of explicit routes. One of them is: routes.MapRoute("default", "", new { controller = "Home", action = "Index" }); At the end, I define a catchall route: routes.MapRoute("PageNotFound", "{*url}", new { controller = "Error", action = "Http404" }); If I go to the homepage http://localhost, then the http404 page is ...

path_prefix for asp.net mvc routes

Hi, I read this article about how you can prefix routes in ruby on rails. I want to be able to do the same thing with asp.net mvc So I want to be able to define a route like : /photographers/1/photos/2 //photo 2 of photographer with id 1 /photographers/1/photos //all of photographer with id 1 Any tips ? EDIT: "photographers/...

LINQ to SQL - converting temporary users to real users

In creating a new ASP.NET MVC application, I have an issue with the approach I'm using to store user-created data for temporary users who have yet to create an account which I then try to convert to a real user. That probably doesn't make much sense, so let me explain: A visitor to the site can enter profile settings before being made ...

ASP.NET MVC Why doesn't my routing work after publish?

Hi, i've got the following routeMaps setup for my website. Running and debugging locally works perfectly. I can publish the website to my server (www) but only the root page works (http://www.domain.com). As soon as I specify a controller (http://www.domain.com/Project) it stops working... What am i doing wrong? Global.asax.vb ' Note...

How to display Linq to Entity query result in ASP.NET MVC view

I have a Link 2 Entity query expression in my ASP.NET MVC app: Dim var = From c In context.Evaluation_Template _ From ae In context.Assigned_Evaluation _ Join ua In context.User_Assignment On ae.Assignment_ID Equals ua.Assignment_ID _ Select c.Evaluation_Name, ae.Due_Date, ua.Is_Started, ua.Is_Completed, u...

How do unit testing for IgnoreRoute in ASP.NET MVC

In ASP.NET MVC, I can get information on unit testing for routes and custom routes, but I can not figure out how to do unit testing for IgnoreRoute. routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Practical code is much appreciated. ASP.NET MVC Framework (Part 2): URL Routing ASP.NET MVC Tip #13 – Unit Test Your Custom Routes A...

GoDaddy Hosting - Medium Trust Workaround?

I've seen a few different questions here on SO related to shared hosting, specifically GoDaddy, with medium trust configurations. While most questions seem to be oriented around trying to include a 3rd party DLL in your application, I really haven't seen a consistent answer on how to move forward. I am trying to utilize the FlickrNet f...