Skip to main content

Questions tagged [asp.net-mvc-5]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
68 views

Managing invalid cookie when 2 users use the same computer and therefore share the same cookie

I have asked this question on stackoverflow... here, I am asking for some feedback on the solution that I have implemented. I am using ASP.NET MVC default template to logout user: ...
Hooman Bahreini's user avatar
3 votes
1 answer
109 views

Caching lookup values in an e-commerce website

I am working on an e-commerce website. I have a CarMake dropdown which contains car make names and their corresponding Id, for example: { 1:Alfa romeo }, { 2:Audi },...
Hooman Bahreini's user avatar
1 vote
1 answer
94 views

ASP.net service that sends email whenever an entity is updated [closed]

I have an ASP.net MVC5 project which involve different domain services, and one of it are EmailService which will send email if entity is updated. ...
calendarw's user avatar
  • 127
1 vote
1 answer
79 views

Making EmployeeHistory ViewModel immutable as code analysis suggested

I want to display on a view the EmployeeHistory view model sorted by elements.assignEffDateNext and I want to instantiate and ...
ckb888's user avatar
  • 41
5 votes
1 answer
96 views

Display all files in a folder (object) along with nested subdirectories part 2

Previous post: Display all files in a folder (object) along with nested subdirectories Task: Given a main directory/folder, list all the files from it and if this directory contains nested sub-...
Alexander Lawaetz's user avatar
4 votes
1 answer
529 views

Display all files in a folder (object) along with nested subdirectories

Follow-up question: Display all files in a folder (object) along with nested subdirectories part 2 Task: Given a main directory/folder, list all the files from it and if this directory have other ...
Alexander Lawaetz's user avatar
2 votes
0 answers
274 views

Handler for jQuery DataTable search with filters and pagination

This AjaxCompound is invoked every time when the user types a key for search or click to sort. It contains 1million data 10 distinct rows by compound name. It takes 1.1 minutes and return only 1-5 KB ...
Ujwal Neupane's user avatar
1 vote
1 answer
2k views

ASP.NET Identity 2.0 UserManager alongside with UnitOfWork and Service-Locator anti-pattern

I was wondering whether it is a good aproach to have Identity 2.0 UserManager next to UnitOfWork pattern? I am using ...
Marek's user avatar
  • 123
2 votes
1 answer
4k views

Member management of Active Directory groups via an ASP.NET MVC website

Background One of the projects I'm working on is an Intranet website which is a front-end for several kinds of data, each aimed at a different set of users. Access to the website is handled through ...
BCdotWEB's user avatar
  • 11.3k
4 votes
1 answer
781 views

Multilingual website with a database

I created a multilingual site in MVC and I reached the current results, but I'm not sure it's the right way. I have created a class named changeLanguage to change ...
Elxan's user avatar
  • 53
0 votes
1 answer
911 views

Entity Framework MVC updating db using a repository method [closed]

I have inherited this code from a legacy project, and it is throwing a New transaction is not allowed because there are other threads running in the session. error. Now I know the problem here is ...
kolin's user avatar
  • 129
2 votes
1 answer
340 views

Creating a simple unit of work with Entity Framework and no repository

I've been trying to implement a .NET MVC Unit of Work API (rather than creating a separate repository), but it doesn't feel right. Am I going about this the correct way? Following advice from here. ...
kolin's user avatar
  • 129
4 votes
2 answers
8k views

Handing "Others" option in dropdown in ASP.Net MVC 5

Business Logic I have a company referral form, and in that form I have dropdown to select from a company list. But when a company is not found in the dropdown, the user can select option as "others", ...
Unbreakable's user avatar
3 votes
1 answer
16k views

Display a dropdown based on another dropdown change

I have a dropdown and when that dropdown changes I want to display/render another dropdown. Can someone help me improve it? So, a person requests for getting referred in a company for a job. When ...
Unbreakable's user avatar
4 votes
1 answer
2k views

Refactoring ViewModel and mapping from multiple sources

I need to refactor and tidy the following controller below, it's my first MVC application. I've successfully used AutoMapper as I began refactor controllers but I am not sure how to approach a ...
Troublesome Junior's user avatar
6 votes
2 answers
7k views

"Forgot password" functionality

I want to implement the "forgot password" functionality in Asp.Net MVC 5. Here is the code flow: Take user email ID Let the user enter the token received in his email inbox If the token matches then ...
Unbreakable's user avatar
2 votes
0 answers
310 views

Navigation Menu Code went from mvc controller into the view model

Sometimes code seems to write itself (kinda like a donut seems to eat itself) and that happened in this case, but I have thought that UI view models (MVC models folder) were supposed to be stupid to ...
toddmo's user avatar
  • 121
1 vote
2 answers
127 views

Good Unit Tests when ReSharper bugs for null checks

I have the latest version of ReSharper installed and I am trying to write a Unit Test for my MVC controller. I need the Unit Test to: Ensure the ViewModel passed to the View is of the correct type. ...
J86's user avatar
  • 414
3 votes
1 answer
67 views

Website to Track Project's Progress

This ASP.NET MVC website is for my professor to track my progress on my Checkers app. This is the first time I have build an ASP.NET website entirely on my own, and I would like a review to make sure ...
user avatar
3 votes
2 answers
3k views

Scraping HTML via async controller & classes + HTML agility pack

I've developed a simple application to grab golfer index scores from a website that has no API. The application works but is very slow, with 6 users that require updating takes 60 seconds. I've tried ...
jon.r's user avatar
  • 419
2 votes
1 answer
3k 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 ...
Yoav's user avatar
  • 319
3 votes
1 answer
851 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 ...
J. Thompson's user avatar
3 votes
1 answer
1k 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. ...
Pedro S Cord's user avatar
-2 votes
1 answer
295 views

Data paging for a forum website in Asp.Net MVC [closed]

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 ...
Ortund's user avatar
  • 531
6 votes
1 answer
13k 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 ...
user avatar
7 votes
1 answer
8k 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 ...
Joe Cuevas's user avatar
2 votes
2 answers
17k 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. ...
SivaRajini's user avatar
2 votes
2 answers
687 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: ...
Misiu's user avatar
  • 349
7 votes
2 answers
11k 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 ...
BWA's user avatar
  • 251
3 votes
1 answer
6k 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 ...
Ortund's user avatar
  • 531
1 vote
1 answer
474 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 ...
Matthew Verstraete's user avatar
1 vote
1 answer
957 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 ...
Ivan's user avatar
  • 111
3 votes
0 answers
719 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 ...
Alexei's user avatar
  • 1,796
3 votes
1 answer
2k 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 ...
Raskolnikov's user avatar
3 votes
2 answers
173 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. ...
Danny's user avatar
  • 133
4 votes
1 answer
123 views

Joining tables with EF

Here is my database: Here is my viewModel: ...
Oli's user avatar
  • 205
5 votes
2 answers
212 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 ...
Mcgri's user avatar
  • 161
8 votes
2 answers
334 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 ...
Mark Kenyon's user avatar
7 votes
2 answers
15k 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 ...
Raskolnikov's user avatar
1 vote
1 answer
1k 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: ...
amplifier's user avatar
  • 113
0 votes
1 answer
356 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 ...
user avatar
3 votes
1 answer
428 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? ...
Andrew's user avatar
  • 133
1 vote
1 answer
902 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: ...
stig's user avatar
  • 113
5 votes
1 answer
536 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? <...
iniki's user avatar
  • 335
5 votes
2 answers
522 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,...
scrapcode's user avatar
6 votes
1 answer
74 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....
DavidJS's user avatar
  • 191
4 votes
1 answer
2k 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 ...
Ivo Coumans's user avatar
2 votes
0 answers
520 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....
user1320170's user avatar
12 votes
3 answers
81k 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, ...
Jason's user avatar
  • 223
3 votes
1 answer
3k 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 ...
BeeTee2's user avatar
  • 133