DataAnnotation RegularExpression problems

Why RegularExpressionAttribute validation doesn't compare the input string with the value of all matches concatenated? I asked a question here about the scenario below, but I found a solution the next day and found it better to raise the issue here....
more »

2017-12-03 19:12 (2) Answers

Measure server HttpRequest's performance

How to measure server HttpRequest's performance? I think it's important task and many peoples solved this challenge. I will explain. I have many user server requests which calls in parallel and i want measure some Performance metrics of identical r...
more »

2017-12-03 18:12 (2) Answers

ASP.NET MVC - View is posting null model

I have been trying to call a POST action from my view. I see POST method parameter is always null. What I am doing wrong ? My model class : public class Survey { public int Id { get; set; } public int QuestionId { get; set; } public str...
more »

2017-12-03 17:12 (1) Answers

event.preventDefault() and redirect asp mvc/jQuery

What am trying to do is to post on form submit to a action and catch response and that works fine.Problem is when RedirectToAction gets called, it just stays on that same view(it doesn't redirect),or in case model is not valid, it doesn't show model ...
more »

2017-12-03 14:12 (1) Answers

404 for Custom ttf Font on Azure (.NET MVC 5)

I have an issue that I have seen previously answered. I implemented the solutions, but the problem persists. I downloaded two custom ttf fonts to use in my project, Monterey and Bakery. Both fonts are installed. Both fronts are in my content fo...
more »

2017-12-02 23:12 (1) Answers

I can't change the boolean values in MVC

I am doing a small MVC project. I want when i click button, Vip status of a user that logging in will change. (Base on session). But when i click, nothing change. Store procedure: CREATE PROCEDURE setupVip2 @MaKhachHang nvarchar(10) A...
more »

2017-12-02 17:12 (2) Answers

Can't remove item from List

I try to remove item from products in DeleteProduct method and Remove method returns true but all items still in list and I can't figure out why. As I understend products list creates at the first start of the application and at static constructor i...
more »

2017-12-02 12:12 (3) Answers

Dapper One To Many Relationship

I have 3 tables structured in the following way: CREATE TABLE [User]( Id int NOT NULL, Name varchar(50) PRIMARY KEY (Id) ) CREATE TABLE [Role]( Id int NOT NULL, UserId int NOT NULL, Name varchar(50), PRIMARY KEY (Id), ...
more »

2017-12-01 23:12 (1) Answers

Mixing entity models and viewmodels in one view

As I am beginning to understand, in MVC it's all about viewmodels to display data in the views. But when the Index-method in my home controller looks like this; public async Task<IActionResult> Index() { return View(await _context.Products...
more »

2017-12-01 21:12 (2) Answers

Passing JSON object into a list

I am new to programming and have a json object with data related to a coin. I want to take the data from the json object and display it using google charts. However I can't seem to be able to get it working. Any input is appreciated. Json object ...
more »

2017-12-01 19:12 (1) Answers

Use [Authorize] Attribute Without Identity?

I've looked around to try and find an answer to my specific question. I'm basically using an external library to check if a user is authorized within our domain via username and password. var authenticatedUser = ECNSecurity.SecurityChecker.Authentic...
more »

2017-11-30 18:11 (2) Answers

Authorize as Roles = "Admin" during login

First of all i am new to MVC user authentication system. Code bellow is working fine for authenticate normal users but i wanted to log all user as per under MVC role based system. So admin user can only see admin controller and normal user cant see a...
more »

2017-11-30 07:11 (1) Answers

Could not load type mvc c#

Has anyone experienced an issue which the view could not load a type from the assembly since you've moved the type to a different namespace on the same assembly? The only resolution for this is for me to add a new line on the view to detect the chang...
more »

2017-11-30 05:11 (0) Answers

Adding dependency as DLL or adding as a project

We have an application written in asp.net mvc. Now we have written common db context & entities module (2 projects/class library) which are required by this application. Same db context and entities would also be required /part of another appli...
more »

2017-11-29 19:11 (3) Answers

Collapsed Menu Not Working

I have a web page that is built using MVC and .NET Core 2. So this page is generated from Razor. When I run the page in Visual Studio and shrink my page down so that the screen is narrower it collapses the menu, and the hamburger menu expands the op...
more »

2017-11-29 09:11 (2) Answers

Generating a PDF File using MVC

I'm trying to generate a PDF using MVC, the problem I have is that I'm not sure how to display or make it work at the end, I'm using an ActionResult where I execute a Stored Procedure and fill a datatable with the result, which I later "try" to use i...
more »

2017-11-28 18:11 (1) Answers

Unity exception interception - configuration

I would like to have one set of interceptors at the MVC or Web API layer that catch any exception, grab the URI that generated the exception, and look up the message back to the user from configuration. For example a POST to /api/v1/user that thro...
more »

2017-11-28 16:11 (1) Answers

Generic ToSelectListItem method

I have about 10 very simple tables in database: create table EmploymentStatus ( Id int identity(1,1) Primary Key, Name nvarchar(100) NOT NULL ) These tables are used for DropDownLists on registration view, like this: @Html.DropDownListFor...
more »

2017-11-28 13:11 (3) Answers