asp.net-mvc

MVC Protecting User Based Data Security

I am starting to dabble with ASP.Net MVC. One question I have is on best practices for protecting user data. For example in the scenario of Sales people, they should only be able to view their own data. e.g. SalesData/Edit/14 It is very easy to change the "14" to view other data which they may/or may not have access to. At this poi...

Using Ajax v Forms

I have a table with each row row containing a task. I would like to have a column with links allowing the user to toggle the completed status of the task. As this is changing data, I only allow the change Action to be called from a Post. I.e. I have an ActionFilter of [AcceptVerbs(HttpVerbs.Post)]. This in turn requires a form in each...

Handling empty collections in view model with spark

In spark when sending a view model to the view when a collection is empty is causing me some headaches like so: <input value="model.addresses[0].street" /> Where "model.addresses" may be empty and thus gives an NRE. Is there anyway to handle this other than populating the collections prior to rendering. This is a bit of a pain as it ...

Over writing ViewDataDictionary in ASP.NET MVC framework

Instead of: public ActionResult Index() { ViewData["foo"] = _repository.GetFoos().ToList(); ViewData["bar"] = new string[] { "blah" }; ViewData["baz"] = ""; return View(); } and then: public ActionResult Index(string baz) { // Do stuff... ViewData["foo"] = _repository.GetFoos().ToList(); ViewData["bar"] ...

Relational database tables

Hello, I'm currently working on an ASP.Net MVC project for a software engineering class. My goal is to create a small online game rental system. I currently have a 3 tables, Movies, Games and Registrants; and I'm using LINQ-to-SQL to define each of these tables as classes for my model. So far I've created models for Movies and Games, ...

Problems with ASP.NET MVC Deployment

Hi all, I'm just a beginner in ASP.NET technologies and a starter about C# though I've experiences over Apache and PHP. Now, I'm on a project that use ASP.NET MVC. Although it works fine while using aps.net deployment server, I became just like a fool when I try to deploy over IIS Server. Honestly saying, I really did follow the instru...

Reusable Content Box Data In ASP.NET MVC?

If I create a PartialView for a box that holds a header, image and content what is the best way to store the content without using a database? Example: TurboTax I doubt the content for the boxes in the sidebar are stored in a database but to make reusable code it would be beneficial to create the structure in a PartialView and populate...

Mvc Using Ajax?

Which MVC version should I download to use the Ajax functionality in my MVC application? Is it possible with MVC 1.0? I also want to use Modal Popups in my application. Thanks Ritz ...

Using Parts of GUID as ID

I'm developing an ASP .Net MVC application. One of my actions requires id as a parameter. For example: public actionresult Detail(Guid id){ return View(); } As you can see, I'm using Guid instead of Int. The issue is more cosmetic. The url can be very long, such as localhost/Detail/0c157b42-379d-41d5-b9ba-83e9df9985b2. Is it safe...

ASP.Net MVC 2: My controller actions are not being called.

I'm not sure what happend but suddenly my controller actions are not being called. This project has been working fine all day, but now when I run it (in Cassini or IIS 7 ) I get "Internet Explorer cannot display the webpage". No server error, not even 404 or 500 error. In stepping through the code I can see that the routes are register...

ASP.NET MVC Spark view engine for designers, do they like it?

I am in the process of building a large asp.net Mvc project and have a question regarding the default rendering engine opposed to the MVC Spark engine in the context for designers. I am all in favour of reducing my tag soup and can see that the spark engine is neat, very neat and I for one would welcome it. However does anyone have an e...

Does AntiForgeryToken in ASP.NET MVC prevent against all CSRF attacks?

Using AntiForgeryToken requires each request to pass a valid token, so malicious web pages with simple script posting data to my web application won't succeed. But what if a malicious script will first make some simple GET request (by Ajax) in order to download the page containing the antiforgery token in a hidden input field, extracts...

mvc calling controller

I have a base controller, is it possible to know what the calling controller was called? ...

ASP.NET MVC - Partially updating model from view

I just wondered how people were approaching this situation. It's something that seems like a weak point in my usage of MVC with ORMs (NHibernate in this case)... Say you have a fine-grained and complicated entity in your model. You will likely have an admin page to manage objects of this type. If the entity is complicated, it is unli...

Using ISAPI Rewrite 3 & ASP.Net MVC?

I'm using ISAPI Rewrite3 on IIS6 for two Virtual Directories at the moment that contain Wordpress. I need to setup some rules at the root of the site to redirect old urls to new urls: i.e. http://www.example.com/somefolder/* > http://www.example.com/newfolder/ & http://www.example.com/somefolder/file_1.htm > http://www.example.com/n...

Model - Partial class and Datacontext class are not communicating.

Hello, I've created a one table contact DB, which has only 3 columns (Id, Name, and Phone). I've then created the ContactsDataContext using my table Contacts in the model folder. Finally, I create a partial class still in the model folder (public partial class Contact). now when I write this public partial class Contact { public...

ASP.NET MVC: Application_Start and Url.Action

Hello everyone, I am struggling with MVC - which I love - and it's features. I am trying to load a menu in the Application_Start event. I want to load some links with the correct url (controllerName/actionName) but I can't use the Url.Action or other methods to build the path. Can anybody help me? Regards Alberto ...

how should i let my asp.net queue with other server?

Im currently writing a application where i need to let my other server queue base on request and after that, the application from my server send back a small data of whether it's finished, still queueing, how many percent, item id, etc... Is there any way i can accomplish this? since i dont want my other server to run another Http insta...

ASP.NET Global.asax Application_Error works but not when using the Error event

Hi, I've got an ASP.NET MVC application that is supposed to catch all unhandled exceptions within the global.asax application error handler. If I define the handler as follows: protected void Application_Error(object sender, EventArgs e) then it works fine. However, if within the Application_Start event I try and do: this.Error +=n...

ASP.NET MVC Route enumeration

In my ASP.NET MVC CMS application I have a bunch of normal content display routes and some administration routes (for CRUD actions). I was thinking of building an admin menu with unordered list and list items HTML elements but I want to do it dynamically at runtime. So the app should enumerate all the routes and construct the menu using ...