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...
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...
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 ...
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"] ...
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, ...
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...
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...
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
...
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...
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...
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...
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...
I have a base controller, is it possible to know what the calling controller was called?
...
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...
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...
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...
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
...
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...
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...
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 ...