10,308 questions with C#-related tags

Sort by: Updated
1 answer

How can I access SharePoint files via a C# web api that uses no user authentication?

I have followed numerous guides on how to access SharePoint via C# and no matter what I do I end up with a "401 Unauthorized response:" I am out o fideas. Anybody able to help? Would prefer working code examples. using…

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,739 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
302 questions
asked 2024-04-26T17:41:06.5666667+00:00
David Finkelstein 0 Reputation points
commented 2024-04-30T06:15:29.47+00:00
RaytheonXie_MSFT 31,681 Reputation points Microsoft Vendor
3 answers One of the answers was accepted by the question author.

How to calculate years from two different date in ASP.NET C#

I have Employee Admission Date which is stored in SQL table. In the ASP.NET click event, i want to calculate and find the years from the Admission Date and Current Date. For example, Admission Date : 10-MAR-2023 Current Date : 28-APR-2024 condition is…

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,288 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-28T17:11:24.31+00:00
Gani_tpt 1,586 Reputation points
commented 2024-04-30T03:29:04.6233333+00:00
Lan Huang-MSFT 25,876 Reputation points Microsoft Vendor
2 answers

How to design patterns from scratch using C# asp.net MVC

I am new to building design pattern using factory design pattern, its C# asp.net mvc application which i am going developing my new web application, please can you help me how to start from scratch. I have worked one design pattern application which is…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,288 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-19T14:27:10.4633333+00:00
coder rock 196 Reputation points
commented 2024-04-30T02:54:25.35+00:00
Lan Huang-MSFT 25,876 Reputation points Microsoft Vendor
1 answer

UWP Designer not showing in Windows 10 22h2

I am using Windows 10 22h2 (19045.4170) and have the latest Windows 11 SDK (22621.0) and Windows 10 SDK (20348.0). In Visual Studio (UWP Project), my target version is Windows 10 version 2104, but I am unable to view the designer and it tells me to…

Universal Windows Platform (UWP)
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,643 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
971 questions
asked 2024-04-08T12:41:37.9933333+00:00
Emmanuel James 20 Reputation points
edited the question 2024-04-30T01:41:51.2066667+00:00
Tianyu Sun-MSFT 27,431 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

MailKit fails to authenticate properly with passwords containing certain characters

I have the following block of code to send an email using MailKit: using (var smtp = new MailKit.Net.Smtp.SmtpClient()) { smtp.Connect("mail.somedomainname.com", 587, SecureSocketOptions.StartTls); …

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-29T22:19:47.19+00:00
Richard Rosenheim 66 Reputation points
commented 2024-04-29T22:53:12.64+00:00
Richard Rosenheim 66 Reputation points
1 answer

How to publish a program that use SQLITE3? (C#)

Basically i wrote a program that use SQLITE3. The path used in my program is correct because uses the relative path and file is in the correct folder. So, i finished the program and i need to send to another person. This person doesn't need to install…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-01-17T17:12:20.6933333+00:00
Alexandre Dantas 40 Reputation points
commented 2024-04-29T22:26:18.8033333+00:00
Alexandre Dantas 40 Reputation points
9 answers

Windows Server 2012 R2 TLS 1.2 Cipher Suites

Hello - I have a .Net application that accesses an external website to retrieve data. The external website removed TLS 1.1 support and only supports the following TLS 1.2 cipher suites: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384…

Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,534 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2021-01-12T14:41:41.363+00:00
Rusty Short 16 Reputation points
commented 2024-04-29T21:25:58.46+00:00
KeithKirkland-4965 1 Reputation point
6 answers

c# When should I use decimal data type?

under what kinds of situations should I use decimal data type? and I found that most likely I can use double instead, would someone give me some hints for that? Thank you

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2022-06-10T06:38:52.85+00:00
Ihandler2 26 Reputation points
answered 2024-04-29T17:27:52.42+00:00
Naughton, Stephen 0 Reputation points
1 answer

Customize the EmailConfirmation and 2FA token expiration in .NET 8.0

Is there a way to extend the 2FA and Email confirmation token expiration timespan with email in .NET 8.0? I am using the Microsoft.AspNetCore.Identity and Microsoft.AspNetCore.Authentication classes to use the 2FA with…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,208 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
302 questions
asked 2024-04-27T00:03:30.5266667+00:00
Francisco A. Henríquez N 0 Reputation points
accepted 2024-04-29T17:04:38.0533333+00:00
Francisco A. Henríquez N 0 Reputation points
2 answers

GetFiles and EnumerationOptions

Hi Question at top to avoid long scrolling below. I have tried so many thing, downloading/installing many 'versions' (5,6,7,8,9) and have not had a single sucess in my trials trying to use (as below). In almost every case I only ever get 'not found'…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-26T10:57:50.91+00:00
Anonymous
commented 2024-04-29T16:19:14.2+00:00
Les 0 Reputation points
1 answer One of the answers was accepted by the question author.

LinQ - XML special path, condition

I need to change an element value that is dependent on the STEP value. MarkPosition or ControlPosition Can I pre-select better with XPathSelectElements? If so, how? <STEP value="MarkPosition"> <STEP…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-26T18:14:43.01+00:00
Noah Aas 140 Reputation points
commented 2024-04-29T14:44:35.12+00:00
Jiale Xue - MSFT 34,276 Reputation points Microsoft Vendor
2 answers One of the answers was accepted by the question author.

efficient way to add csv to database

Hello I read a csv text file line by line and use oldb sql command insert into table to add each line's fields to the table's row. But it takes a very long time, I wonder if there's faster achievements, please advise the most efficient and fastest way to…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
asked 2024-04-26T08:05:21.28+00:00
StewartBW 325 Reputation points
accepted 2024-04-29T14:30:16.48+00:00
StewartBW 325 Reputation points
1 answer

C# Generate token console for Intune datawarehouse

Using .NET 4.8.1 and the code snippet below from Microsoft Learn (https://learn.microsoft.com/en-us/mem/intune/developer/data-warehouse-app-only-auth-). I am unable to get this module to work. It seems the line with AuthenticationContext,…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
Microsoft Intune Security
Microsoft Intune Security
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
345 questions
asked 2024-03-07T16:46:48.8866667+00:00
Chaumette Garcia 0 Reputation points
answered 2024-04-29T12:36:04.6966667+00:00
Catherine Kyalo 570 Reputation points Microsoft Employee
1 answer

Microsoft Graph API returns no data or unexpected errors for Viva Learning

Hello, I'm exploring options to create a custom learning management system for my company. The first thing I would like to do is to pull data from Microsoft Viva Learning via the Microsoft Graph API, for example to see which courses the employees have…

Viva Learning
Viva Learning
A Microsoft Viva module that provides employees with formal and informal learning.
85 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,716 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-26T09:44:11.1233333+00:00
Bruno 0 Reputation points
commented 2024-04-29T11:49:55.18+00:00
Bruno 0 Reputation points
0 answers

Direct API POST method to another URL

Good morning, afternoon or night!! Dear all, I will need to be "listening" to an Access device that will be sending a Json in the POST Method. To do this, I created a (simple) API to do this monitoring and respond with a True or False. Problem:…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,208 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-27T13:11:19.82+00:00
Marcelo Nogueira 20 Reputation points
commented 2024-04-29T10:09:31.17+00:00
AgaveJoe 26,146 Reputation points
1 answer

x:Bind default Mode is "OneTime" or sth else in Windows App SDK ?

I have written the code below: XAML code: <ListView ItemsSource="{x:Bind players}"> ***<ListView.ItemTemplate>*** ***<DataTemplate x:DataType="local:Numbers">*** ***<TextBlock…

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
727 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-28T01:44:47.1666667+00:00
Konstantinos Pavlis 0 Reputation points
commented 2024-04-29T09:18:15.2066667+00:00
Junjie Zhu - MSFT 15,366 Reputation points Microsoft Vendor
1 answer

How to fix XamlReader.RewrapException(ex, xamlLineInfo, baseUri);

Here is the error System.Windows.Markup.XamlParseException: "'The invocation of the constructor on type 'DentistryOOP.View.MainWindow' that matches the specified binding constraints threw an exception.' Line number '6' and line position…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
768 questions
asked 2024-04-26T10:23:50.44+00:00
commented 2024-04-29T03:22:15.68+00:00
Hui Liu-MSFT 40,786 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

C# Regex pattern double quotes problem

Hello all. In the following code if the user string input is "a"b" or "a\"b" is match a"b string. I don't expect that "a"b" is a valid regex pattern as the code return true in the try catch block. what…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-28T10:01:51.6966667+00:00
Haviv Elbsz 1,926 Reputation points
accepted 2024-04-28T20:10:00.8533333+00:00
Haviv Elbsz 1,926 Reputation points
1 answer

how to export function in dll to aot?

I created .net class library to build dll and want to publish native aot and I write function public static MyClass { public static int MyFun(int n) { return n*n; } } I publish it to native aot to win-x64 but in dll there is no function why?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-23T02:04:43.3933333+00:00
mc 3,701 Reputation points
edited an answer 2024-04-28T16:22:18.2966667+00:00
Bruce (SqlWork.com) 56,931 Reputation points
2 answers One of the answers was accepted by the question author.

Custom ApiController Model Binding type conversion error

According to the Model Binding documentation: In an API controller that has the [ApiController] attribute, invalid model state results in an automatic HTTP 400 response. So when I send an invalid type in the request body (e.g. int instead of string),…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,208 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 questions
asked 2024-04-24T10:30:29.13+00:00
iKingNinja 60 Reputation points
accepted 2024-04-28T11:08:20.8766667+00:00
iKingNinja 60 Reputation points