asp.net-mvc

What are the best security practices for having a really secured site with asp.net mvc?

I searched all over the internet trying to get a guidance about the security practices for a really secured site like an online banking site and didn't find any. My interest is to know what practices you are using in following areas: Communication: definitely using SSL ... any extra tips to protect against "man-in-the-middle" attacks....

Setting user roles in controllers?

I need to be able to manually authorize my users in my controller. I get my authentication from an AD, and then in my controller, I want to map up the userID I get from the AD, to my application's internal userID. Grab the userId from the UserRole table, and then set it in the controller, however, I don't know how to set the role in the ...

How to identify if cookies are disabled

I want to identify on my login page that user browser cookies are disabled, so i can display a message that enable your cookies and then try to login, how to do this? Im using asp.net mvc-2 ...

Asp.Net MVC Ninject and Areas

I have a site that uses Ninject for dependency injection and I have Routing defined within a Bootstrapper class like so: public void RegisterRoutes() { Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); Routes.MapRoute( ...

How to implement the partial page loading functionality

Hi All, I have a application which has very bulky page and i can not reduce the functionality any more. Because of this my every page is taking too much time to load completely. Is there any way to load the page in sequential manner. Link once i hit the URL few content get displayed immediately and other contents will get displayed on...

Succinct way to remove whitespace from model property values in MVC view

I'm using MVC and in my View I'm assigning classes to various divs, etc using the values of certain properties within my View Model. However, these values contain spaces and I need to remove the spaces before rendering the HTML. Is there another way of doing this? <% Response.Write(benefit.Name.Replace(" ","")); %> ...

How to bind list to a controller

Hello everybody, How to bind a list to a controller? Code in my controller, HTTPGET and HTTPPOST : public ActionResult Client(string id) { List<Customer> Contacts = WebService.GetContactsOfClient(id); return View(Contacts); } [HttpPost] public ActionResult Client(List<Customer> custs...

Asp.net mvc dynamic route for Categories tree

Hi Is it possible to create a route, who accepts X number of Categories/subCategories mysite.com/CategoryName//ProductID/ProductName mysite.com/CategoryName/Sub1CategoryName/ProductID/ProductName mysite.com/CategoryName/Sub1CategoryName/Sub2Category/ProductID/ProductName Of cource I could create a route for each possible combination, ...

ASP.NET MVC - Passing JSON DateTime to controller not mapping to controller parameters

Hi There, I am using a jQuery calendar to display events, which is designed to pull data from the server. On innit the calendar fires off a AJAX request to get an array of events objects (json encoded). All good so far. However, this request includes a JSON encoded date and time (at leats my implimentation does). The code looks like thi...

asp.net mvc testing: can't get access to object inside action

having public ActionResult Create(CategoryViewModel viewModel) { if (!ModelState.IsValid) { return View(viewModel); } Category category = new Category(); category.Parent = daoTemplate.FindByID<Category>(viewModel.ParentId); category.CopyFrom(viewModel); daoTemplate....

Redirecting expired users

I am currently working on an ASP.NET MVC2 application and would just like to know the best way of achieving the following: Each user that logs into the site pays membership fee which lasts X amount of days. I record the membership payments and the expiry dates in the database. I would like all users to be able to login even if their me...

routing in asp.net mvc.

I have a route routes.MapRoute("BuildingProject", "BuildingProject/{action}/{id}", new { controller = "Home", action = "Index", id = "" }); i want it to behave like default route ie for url that starts with BuildingProject like http://localhost:4030/BuildingProject/DeleteAll. I tried routes.MapRoute("BuildingProject", "Build...

how to pass part's of a main view's model to partial view

I have the below view model that has both school and Address objects like namespace myapplication.ViewModels { public class SchoolViewModel { public Address schoolAddress { get; set; } public School school { get; set; } } } and I have student,teacher and other objects that has address with addressId fie...

Is this a good time to use multithreading in ASP.NET MVC and how is it implemented?

I want a certain action request to trigger a set of e-mail notifications. The user does something, and it sends the emails. However I do not want the user to wait for page response until the system generates and sends the e-mails. Should I use multithreading for this? Will this even work in ASP.NET MVC? I want the user to get a page resp...

Self binding Membership provider with Ninject

I am trying to self bind MembershipProvider in ASP.NET MVC 2 and then use this binding in an AccountController constructor. This is a snippet from my global.asax.cs // selfbind MembershipProvider in request scope Bind<MembershipProvider>().ToSelf().InRequestScope(); And a snippet from service class: public AccountMembershipService(M...

ASP.NET MVC how to make an action that return a file?

Hello I am generating an excel file inside my action that I would return to the user. How do I have to declare the action to return a file? May I call this action with ajax? thanks! ...

ASP.NET MVC - HttpException or return view?

I'm trying to make a request for a customer and if the customer doesn't exist it should return some kind of "Not found" page. Which of the below would be the best practice to use for such a task, and why? public ActionResult Index(int id) { if (customerService.GetCustomerById(id) == null) return View("NotFound"); retur...

Global.asax.cs file is not recompiling--file is valid

I recently refactored some code, and a method the original Global.asax.cs file was depending on was no longer static. When I made changes to my Global.asax.cs code to fix the compilation problem, VisualStudio Development Server is still reporting the old problem. To make things more confusing, it's reporting the old problem with the ne...

Is it possible to localize a URL / routing in ASP.NET MVC?

I'm working with a client that wants the URLs in our web application to be in French. I'm an English developer and we also have English clients. This is an interesting problem but I don't think its something the ASP.NET MVC Framework would support. Here's the scenario. The route... Specific EXAMPLE English URL www.stackoverflow.com/...

Check conditions on each page request

I have multi-tenant ASP.NET MVC application which utilizes subdomains to determine the current tenant. Whether or not the domain is valid is determined via database table lookup. Where would be the best place to have a function that checks if the domain is in the database?If the subdomain is not in the database, it should redirect to th...