Application Crashes when Accessing Database

I have a small web application which runs fine on my PC, but when I publish it to the server, the app crashes when querying the database. I have narrowed it down to this line: output = (List<Pallet>)db.Query<Pallet>(query, args); Whe...
more »

2017-05-14 21:05 (1) Answers

Entity Framework not creating table correctly

I am working on creating a .NET Web Application and have just discovered Entity Framework. I am very new to this and have been going through a tutorial using Code First Migration. I am trying to seed data into a few tables and one of them is not ge...
more »

2017-05-13 05:05 (0) Answers

Choosing the proper C# Project (Active Directory)

I have recently started an internship in a big company (4.5k employees) which uses an Active Directory and have an intranet web app allowing them to handle all types of services, going from administration to user creation etc ... It was developped in...
more »

2017-05-12 13:05 (1) Answers

MVC : File.exists return false

I have a MVC method like this : public ActionResult DownloadDocument(string filePath){ //Other stuff if (!System.IO.File.Exists(filePath)) { FileLogger.Debug($"DownloadDocument : {filePath} NotFound"); } //Other stuff } file...
more »

2017-05-12 11:05 (2) Answers

Can't access a file

I've inherited a new project. The website (MVC.NET) is referencing a file location on the Windows 2012 server (it appears to be hard coded) but the file is not in the same directory as the website. Part of the code copies a file from one location t...
more »

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

Load one-to-many model

I have such models: public partial class Goods { public decimal good_id { get; set; } public string good_name { get; set; } public virtual ICollection<Description> description { get; set; } } public partial class Description { ...
more »

2017-05-11 09:05 (3) Answers

Cors issue across domains

We have a very badly written legacy WebSite application that we are trying to slowly convert to MVC. As part of this we will be creating a set of MVC controllers that we would like to be able to call from the legacy website as a stopgap measure. So...
more »

2017-05-11 08:05 (1) Answers

ASP.net Token Based Authentication

I have a web application built using ASP.NET MVC 5. I would like to know if i were to use a token based authentication as opposed to a session-based authentication(forms authentication) (using OWIN as the authentication middle-ware), do i need to a...
more »

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

How to save string value of enum mvc

I am new to MVC. I am using the following enum in my Orders table: public enum OrderStatus { Pending = 1, Held = 2, [Display(Name = "In Process")] In_Process = 3, Completed = 4, Shipped = 5, ...
more »

2017-05-10 22:05 (1) Answers

C# MVC Route detection

I need to call customer profile page like "(www.mysite.com/John) or (www.mysite.com/customer name)" so i had add route to be like that routes.MapRoute( name: "Profile", url: "{id}", defaults: new { controll...
more »

2017-05-10 14:05 (4) Answers

Get an instance of an interface from Unity

I am trying to setup a custom authenticaion filter in my MVC application, but I need to have a reference to my user service, in the authentication filter. I setup my services with Unity like so: private static Lazy<IUnityContainer> contain...
more »

2017-05-10 02:05 (1) Answers

Bindig ListBox selection to model properties

I've been struggling to bind a MultiSelectList from Html helper to a specific model. Model In my model I have something like this: public class DefaultSelection { public SelectionItem Selection1 {get;set;} public SelectionItem Selection2 {...
more »

2017-05-09 17:05 (2) Answers