Questions tagged by "c#"


0
 bounty
0
answers
How to Enable logging the application process stdout messages in Visual Studio?
4 years ago • allexx@qrid
How to Enable logging the application process stdout messages in Visual Studio 2019 when starting and debugging web application?
Tags: ,
0
 bounty
1
answers
Visual Studio - HTTP Error 500.30 - ANCM In-Process Start Failure
4 years ago • allexx@qrid
Trying to start web project - Debug - Start new instance - from Visual Studio 2019. It opens the browser at http://localhost:5221/ with the following error message HTTP Error 500.30 - ANCM In-Process Start Failure Instructions in the above page suggest the following: Common causes of this issue: The application failed to start The application started but then stopped The application started but threw an exception during startup Troubleshoot
Tags: ,
0
 bounty
0
answers
c# multi-line string value in CSV file for Excel?
5 years ago • allexx@qrid
How to store multi-line string as a field column value in CSV file? Assuming I want to later open this file in MS Excel?
Tags: , ,
0
 bounty
0
answers
getBytes() in Java returns different byte array than getBytes () to c #
9 years ago • lampego1@qrid
Hi everyone. I runs this Java code: String s = "73b53b86-eee3-44d2-82e3-be94d93deb5b"; byte[] result = s.getBytes(Charset.forName("UTF-8")); Length of the result var: 23 And runs this C# code: string s = "73b53b86-eee3-44d2-82e3-be94d93deb5b"; byte[] result = Encoding.UTF8.GetBytes(s); Length of the result var: 36 I can not understand what the problem is. Thanks
0
 bounty
1
answers
How can I configure transformation of App.conf file in Visial Studio
9 years ago • kulibin
I want to build different assemblies for my Windows Forms applications but I found what Win Forms application does not contains App.Debug.conf etc. For example in Web App I can click to "Add config transofm" and get new configuration file for current release configuration. How can I build applications with different release configurations(Debug, Release, etc.)?
0
 bounty
1
answers
.NET - compile all DLL dependencies into one standalone portable EXE file for console or a desktop project in Visual Studio
9 years ago • lampego1@qrid
I have a small console project in Visual Studio 2010 and I want to build and publish console application as a standalone EXE file or package with a small number of files to be copy-paste deployed if possible. There is of course an .EXE file with a bunch of .DLL files in ProjDir/bin/Release but this folder contains multiple files(DLLs, config file, resource etc.), and I would prefer to have just one .EXE file if possible. If anyone knows a goo
0
 bounty
1
answers
Integrating Microsoft OIDC IdentityServer3 with our own ASP.NET Simple Membership Provider / user database
9 years ago • lampego1@qrid
I have deployed an instance of IdentityServer3 and now I need to customize their default implementation to use our existing user membership database and Simple Membership Provider. By default, IdentityServer just takes a list of InMemoryUser objects and then just stores that list in memory variable. This, of course, never intended to work for any production implementation b/c you would want your users to be stored in the database and not in a
0
 bounty
0
answers
Owin. How can I get current App context?
9 years ago • lampego1@qrid
Hello :) For example. Startup project: I configure and create Owin App. Core project: This project is core. In this project, all the magic happens. But! I want to configure DB connection for Core project in Startup project and have these settings in classes of a Core project project. I believe that it should be done like this: class Strartup { public void Configuration(IAppBuilder app) { app.Properties.Add("ConnectionStri
0
 bounty
2
answers
HttpContext.Current is null in the WebAPI project
9 years ago • lampego1@qrid
Environment: VS2013 .NET 4.5 WebAPI project I try to get a "MapPath" path for some dir, but in the WebAPI project "HttpContext.Current" is NULL How example: string path = HttpContext.Current.Server.MapPath("~/Some/Path"); Please. Help me!
0
 bounty
1
answers
Create RSACryptoServiceProvider object with keys defined as strings without going through X509Certificate2 object
9 years ago • lampego1@qrid
Quite often people use X509Certificate2 object to instantiate a RSACryptoServiceProvider object: var rsaObj = new X509Certificate2("some-cert.p12", "password", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet).PrivateKey as RSACryptoServiceProvider; I want to generate the RSACryptoServiceProvider object using private and public keys defined as strings, without going through X509Certificate. Please help!
0
 bounty
1
answers
C# Error - Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal
9 years ago • alex
Getting the following compile error: Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Net; using System.Net.Http; using System.Web.Http; namespace MyProject.Controllers { protected class MyControllerBase : ApiController { } }
Tags:
0
 bounty
1
answers
ASP.NET Web Api - how to include API version number in the path as routing parameter
9 years ago • alex
How to include API version number v1, v2, v3, etc in the path (like .../v1/... ) and have it: being used to select proper version of Controller class carried over to Controller as a parameter (optional) HTTP Calls Here is how HTTP calls to different API versions would look like: /v1/User/SomeAction?param=zzz /v2/User/SomeAction?param=zzz .... /vNN/User/SomeAction?param=zzz Controllers Now let's take a look at the server side. In most
0
 bounty
1
answers
How I can make loop through all the resources in a resource file?
10 years ago • lampego1@qrid
Hello. I need make loop through all the resources in a resource file. But I don't know how do it Please, help
0.5
 bounty
1
answers
Get ViewResult from ViewEngineResult object that was obtained through ViewEngines.Engines.FindView - ASP.NET MVC
10 years ago • alex
We have some custom MVC controller that dynamically loads different views with view name being specified through action parameter. It was working fine. Now we are going through a website localization project translating most of our UI to another language. We will deploy the same codebase to 2 different websites, and the WEB.CONFIG culture settings would dictate the UI language for each site. We used resources for most of the site localization
1
 bounty
0
answers
C# console app throws System.TypeInitializationException at Program..cctor() at Program.Main(String[] args)
10 years ago • alex
I have a console .NET application, let's call it MyProject, which runs scheduled using Windows Task Scheduler. I've noticed a command window that shows the following output in the black cmd window: Unhandled Exception: System.TypeInitializationException: The type initializer for 'MyProject.Program' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object. at MyProject.Program..cctor() --
0
 bounty
1
answers
.Net - Error - SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
10 years ago • lampego1@qrid
I am creating an object in C#, populating it with some data and then trying to save it into SQL Server table: User someUser = new User() { UserName = "TestUser", CreateDate = DateTime.MinValue }; I am getting the following error from MS SQL Server: > Error - SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM Please help! Thanks!
0
 bounty
1
answers
How can I calculate difference between two dates in C#?
10 years ago • lampego1@qrid
I have seen some answers for Java, Javascript, and PHP, but nothing for C#. So, how one might calculate the number of days between two dates in C#? Thanks.
0
 bounty
1
answers
Reference to ConfigurationManager class generates compile errors in .net 4.5
10 years ago • lampego1@qrid
I'm using this namespace: using System.Configuration; and here is my code: private static string _smtpServer = ConfigurationManager.AppSettings["SMTPServer"]; However I am getting a compilation error saying that "ConfigurationManager" does not exist. Thanks
1
 bounty
0
answers
How would you count occurrences of a string within a string?
10 years ago • kojemyakin
I am doing something where I realised I wanted to count how many /s I could find in a string, and then it struck me, that there were about several ways to do it, but couldn't decide on what the best (or easiest) was. At the moment I'm going with something like: string source = "/once/upon/a/time/"; int count = source.Length - source.Replace("/", "").Length; But I don't like it at all, any takers? I don't really want to dig out RegEx for th
Tags: ,
1 from 19