ASP.NET MVC 5 is the fifth major version of the ASP.NET Model-View-Controller platform for web applications.

learn more… | top users | synonyms

2
votes
1answer
76 views

Logging requests on a separate thread

I have an ASP.NET MVC 5 application that needs to log to the database every request for a specific controller action and every link click that happens on the view of that action. Since the user ...
3
votes
0answers
81 views

ASP.NET MVC - server-side Ajax result conversion

I am currently in the process of creating a website which requires it to work with and without JavaScript enabled. All callbacks to the server with JavaScript enabled will be made through Ajax ...
3
votes
1answer
78 views

An Edit action in ASP.NET MVC, with handling for missing id parameter

I have a standard Edit action in Asp.Net MVC 5 and I want to avoid throwing the unhandled exception when is made a get request without the id like ~/food/edit, so I did this. ...
0
votes
1answer
73 views

Data paging for a forum website in Asp.Net MVC

I've struggled with this for quite some time. Today I finally wrote the following code. The ViewModel contains an int property which later tells the view how many ...
2
votes
1answer
109 views

Ensuring specific columns in an ExcelWorksheet format as ShortDate

For a while, I have worked with the Nuget Epplus package to export MVC models to fresh Excel documents. While the code I show below works correctly, I have a feeling that either I can make this code ...
3
votes
0answers
377 views

Using Identity to create user administration page

I'm developing an ASP.Net web application, using MVC 5. This application authenticates via LDAP and will assign an Identity Role of "Admin" to a designated user. The Admin user will be able to go to ...
2
votes
2answers
799 views

Calling Web API from MVC generic way of approach

Our Project architecture is AngularJS + MVC + WebAPI. Angular JS would call MVC action and MVC action further calls API methods. Below are some of the action methods we used for calling api methods. ...
1
vote
2answers
85 views

ASP.NET WebAPI `In` Validation Attribute

I've created custom validation attribute that will be used to validate model. It allows me to specify values that are valid for specific field. Here is my code: ...
7
votes
2answers
440 views

Get host ip address behind load balancer or without lb

Description Aplication type: WEB API .NET Framework: 4.5 MVC: 5 I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...
2
votes
1answer
1k views

Login system using a persistent cookie

I want to be sure that my code below properly secures the website based on all of the information provided. Login System Overview When a user logs in, the following user info is saved to a ...
1
vote
1answer
61 views

Refining an ASP.Net MVC VeiwModel for a Table to display worked hours

I am writing an ASP.Net MVC app which has a page that will display a standard table which will contain a person's hours for the week. The basic structure of the table would be a 7 column, muti-row ...
0
votes
1answer
131 views

Bundling JavaScript resources for an MVC app

This is my first MVC app. I'm looking for best practice feedback on how to best bundle the files that I need, the order to bundle them, the placement of the @render ...
3
votes
0answers
282 views

AngularJS client side logging in a MVC web application

Being a newbie into AngularJS, I have overlooked the importance of client side logging until some non-reproducible client-side errors occurred and I realized that they were not logged. My web ...
1
vote
1answer
186 views

Create “refresh token” action filter

I am using idenity server 3 authentication. I have to implement refresh token logic. AccessTokenLifetime is 1 hour, and after that time I want to update access token with refresh token. I want do ...
4
votes
2answers
151 views

Using viewmodel create comper and edit

I have this really long httppost action results that I add and update 3 db tables I think it's too long and can get shorter and smarter. ...
4
votes
1answer
96 views

Joining tables with EF

Here is my database: Here is my viewModel: ...
4
votes
2answers
156 views

Keeping data processing out of controllers

I would like to start by mentioning that I am LAMP stack guy who happens to be making my first ever .NET C# web app and I'm seeking general advises for best practices and to see how more experienced ...
8
votes
2answers
147 views

Saving data in MVC

We have a lot of Controller ActionResults like this in our MVC project. The controllers get really cluttered up. This is a simple example, but we have much more ...
3
votes
2answers
781 views

Clean call api from client, with good practice

I am working on architecture where I can have any client + server API. I need to call API as clean as possible and get, post, put any object I want to. For me, it is important to have clean secure ...
1
vote
0answers
142 views

Securing User Credentials in Cookies

I have an asp.net/MVC5 app that for reasons that are outside of my control needs to hang onto (some) user credentials (username and password) to facilitate certain operations they may perform. I don't ...
1
vote
1answer
296 views

Using custom negotiator and custom formatter in Web API 2

Here's my custom formatter which I want to use for "application/x.product" content type: ...
0
votes
1answer
50 views

MVC.Net View Model

I'm nearing the end of my first MVC project which uses VB.Net and MVC5. I've started writing all my view models in a very similar fashion. This has been working well for me, but being the first ...
3
votes
1answer
163 views

Configuring MVC 5 project with service layer and DI and UOW

In the past I have always called the repositories directly from the controller, but that is a bad practice and now I am implementing a "Business Layer" to my project. Would I have two UnitOfWorks? ...
1
vote
1answer
133 views

Formatting MVC 5 Razor link as a string

MVC 5 doesn't seem to like JavaScript that much. I am creating link in JavaScript to a success method in my Ajax call. Razor: ...
5
votes
1answer
135 views

Redirecting a user

When the user clicks the first button ('Back to List' button), I redirect the user to the Employee List page. Can you please review this and suggest if there is any better way of achieving the same? <...
5
votes
2answers
132 views

Support ticket application: ticket listing index with sorting and filtering

I am new to ASP.NET (C#) and MVC 5. I'm really enjoying it so far, but want to take a step back and make sure that I'm following best practices here. My controller seems like it may be getting too fat,...
6
votes
1answer
56 views

Searching school data

I am running a test load using Telerik Test Studio using 100 users at once entering search filters on a page that calls a stored procedure. My application that calls the stored procedure is an ASP....
4
votes
1answer
1k views

N-layered application structure in ASP.NET MVC 5

I've been trying to set up an n-layered application in ASP.NET MVC 5. I've converted my account controller to look like this. I would like some feedback as to whether this is going in the right ...
1
vote
0answers
348 views

WebApi synchronize database (EF 6) access

I'm working on an ASP.Net MVC 5/WebApi 2 project. I'm using EF 6 code first for my database access. I have a WebApi action method in which I've to update some data in my database based on the request....
7
votes
2answers
51k views

Simple authentication in ASP.NET MVC 5

I am building an ASP.NET MVC 5 application and, for reasons which are irrelevant at this point, I am attempting to build my own means of authenticating users. I'm still very new to programming, ...
3
votes
1answer
2k views

Web application using the repository pattern

I have an ASP.NET MVC 5 web application using the repository pattern, and I have several controllers that need to call my _loggingService (queries audit logs) to ...
2
votes
2answers
206 views

Student data in a database [closed]

I am working on an ASP.NET MVC 5 project, using the code-first approach for database design. I have a question about my code design. I have an Entity in my database schema called ...