Check size of uploaded file in mb
I need to verify that a file upload by a user does not exceed 10mb. Will this get the job done? ```csharp var fileSize = imageFile.ContentLength; if ((fileSize * 131072) > 10) { // image i...
- Modified
- 30 Apr at 17:51
EF6, SQLite won't work without App.config
I'm trying to make a plug in that will use EF6.1 and SQLite for an app where I can't change the App.config so all the configuration and connection string needs to be set in code. I found this answer ...
- Modified
- 2 Sep at 18:5
Can Nullable types be sent through Protocol Buffers?
The [Proto3 C# Reference](https://developers.google.com/protocol-buffers/docs/reference/csharp-generated#wrapper_types) contains the following text: > Most of the well-known types in proto3 do not af...
- Modified
- 25 Apr at 16:9
Project X targets '.NETStandard,Version=v1.6'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1'
I really wanted to be a good citizen... copied all my classes to .net standard libraries. Just to find out that my test DLL can't use it. I get the following error > Project X targets '.NETStandard,...
- Modified
- 28 Dec at 06:41
An enumerable sequence of parameters (arrays, lists, etc) is not allowed in this context in Dapper
I have the following code: ``` static void Main(string[] args){ string sql= "SELECT * FROM Posts WHERE 1=1 "; SqlParameter[] @params= SetDynamicParameter(ref sql, "Param=Value", "Para...
Azure DocumentDB Read Document Resource Not Found
I'm building a .Net Console application to read information in a DocumentDB. The console app has data coming from an EventHub and inserts/updates recent data as it comes into the cloud. I am trying t...
- Modified
- 22 Dec at 18:16
BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format
I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". ``` Could not load file...
- Modified
- 4 May at 13:15
Setup RabbitMQ consumer in ASP.NET Core application
I have an ASP.NET Core application where I would like to consume RabbitMQ messages. I have successfully set up the publishers and consumers in command line applications, but I'm not sure how to set i...
- Modified
- 25 Apr at 11:23
Negate `.Where()` LINQ Expression
I understand that you can do the following: ``` enumerable.Where(MethodGroup).DoSomething(); ``` and that this achieves the same thing as: ``` enumerable.Where(x => MyMethod(x)).DoSomething(); ```...
Is it possible to redirect request from middleware in .net core
What I'm trying to achieve is this: When someone visits: `smartphone.webshop.nl/home/index` I want to redirect this from middle ware to: `webshop.nl/smartphone/home/index` I want to do this because I...
- Modified
- 8 Oct at 09:21
AutoMapper throwing "No default constructor" during validation
I have classes to map, but they don't have default constructors, and I don't want them to have. This is because I only map to/from already existing objects. ``` public class Order { public string...
- Modified
- 25 Apr at 09:37
Split by '/' till '[' appears
I want to split the following kind of string: > Parent/Child/Value [4za] AX/BY and get create a `String[]` out of it via: ``` String[] ArrayVar = Regex.Split(stringVar, "?"); ``` which split the stri...
object initialization can be simplified
With my code I get 3 messages all saying `object initialization can be simplified` and in my ever growing thirst for knowledge (and my OCD) I would like to "fix" my code so that these messages dont ap...
- Modified
- 25 Apr at 09:1
in ASP.NET Core, is there any way to set up middleware from Program.cs?
I am building a support library for ASP.NET Core websites. I have a few pieces of middleware that need to be enabled, and they need to be added before any other middleware due what they do. I can cr...
- Modified
- 25 Apr at 06:59
How do I set `OutputPath` in a Visual Studio 2017 project (new .csproj file format) without the target framework cluttering the resolved path?
Setting `OutputPath` in the new Visual Studio 2017 project format automatically adds the target framework in the path. For example, if I have these set in the project file: ``` <TargetFramework>net46...
- Modified
- 21 Jul at 21:53
Component is part of the declaration of 2 modules
I try to build an ionic 2 app. When I try the app in the browser with ionic serve or launch it on an emulator everything works fine. But when I try to build it every time the error ``` ionic-app-scrip...
- Modified
- 30 Apr at 18:31
Alternatives for updating mesh collider in runtime?
I'm working on game where user generating mesh in runtime (all the time) so mesh have many vertices and in the same time there is a GameObject - player that need to trigger event when it is in area of...
- Modified
- 27 Apr at 19:43
Error occurred during the pre-login handshake
In a project that I am debugging I receive a SqlException saying the following: > Additional information: A connection was successfully established with the server, but then an error occurred durin...
- Modified
- 24 Apr at 22:51
How to change python version in anaconda spyder
I am using 3.6 Python version in anaconda spyder on my mac. But I want to change it to Python 2.7. Can any one tell me how to do that?
Replace service registration in ASP.NET Core built-in DI container?
Let us consider a service registration in `Startup.ConfigureServices`: ``` public void ConfigureServices(IServiceCollection services) { services.AddTransient<IFoo, FooA>(); } ``` Is it possible...
- Modified
- 24 Apr at 14:26
Load XDocument asynchronously
I want to load large XML documents into XDocument objects. The simple synchronous approach using `XDocument.Load(path, loadOptions)` works great, but blocks for an uncomfortably long time in a GUI con...
- Modified
- 24 Apr at 14:8
WMV streaming file size limit
I have a windows media player embedded in my web page view: ``` <div id="divCourseVideo" style="width:100%;margin:0 auto;" class="container"> <OBJECT style="display:inline-block" ID="CoursePl...
- Modified
- 7 Jul at 13:10
Retrieve the names of all the boolean properties of a class which are true
I have a class that has lots of bool properties. How can I create another property that is a list of strings that contains the name of the properties which have a value of true? See initial attempt b...
- Modified
- 24 Apr at 13:0
Jenkins pipeline if else not working
I am creating a sample jenkins pipeline, here is the code. ``` pipeline { agent any stages { stage('test') { steps { sh 'echo hello' } ...
How to generate odata v4 c# proxy client for Visual Studio 2017?
Where can i get odata v4 c# proxy generator for Visual Studio 2017? The existing one is for 2015 only.
- Modified
- 24 Apr at 11:49