Questions tagged [.net-4.5]
Version 4.5 of the Microsoft .NET Framework. Use for questions specifically related to .NET Framework 4.5. For questions on .NET Framework generally, use the .net tag.
3,778
questions
0
votes
0
answers
23
views
Getting error in jenkins while .net project publish "No home directory is available for .NET SDK '.NET4.5'"
I am trying to publish website using .Net 4.5 but getting error mentioned in the subject.
The option selected for Build steps is as follow,
".NET: Publish project (publish)"
Since I am new ...
0
votes
1
answer
56
views
WPF not disposing viewmodel
I am having an issue of memory leaks regarding WPF. I have a view model that is not being disposed.
I narrowed the problem to a method that is calling the database and updating the fields on the ...
0
votes
1
answer
129
views
How can I see the TLS version of an incoming API request - ASP.NET
I have a web app hosted on Microsoft Azure that includes a Web API. I am targeting .NET Framework 4.5.
I am working through all the required steps in order to make TLS 1.2 the minimum version required ...
0
votes
0
answers
23
views
How to receive data from the printer(HP LaserJet Pro M305d); for example Load Paper, In windows form Application .Net 4.5 C#
as i said i am developing windows form application using .Net 4.5 C#, Now i want to receive info about the printer status, i used one of the way i found, here is it:
private bool ...
0
votes
0
answers
9
views
Can I serve a Vue/TS app from a wwwroot folder in a .Net Framework 4.5.2 WebAPI appl?
I have a 4.5.2 WebAPI that is accessed from a Vuejs2/TypeScript SPA app.
I want to overcome CORS by running the built Vue2 app from a subfolder directly in the WebAPI app (e.g. wwwroot or clientapp).
...
0
votes
1
answer
71
views
Unexpected behavior using ClientWebSocket SendAsync and ReceiveAsync methods simultaniously in different tasks (.Net Framework)
I have my custom WebSocket client (using System.Net.WebSockets library) that works pretty well. Internally, library has 2 separate Tasks: first task is sending commands to the web socket server, ...
0
votes
0
answers
18
views
VM_AccountHistory list is null. Object reference not set to an instance of an object in c#
public ActionResult ReportWrongCompare(VM_ReportComparison model, AccountTypes accountType)
{
model.SelectedAccountType = accountType;
var accountHistoryData = new VM_AccountHistory()....
-2
votes
1
answer
72
views
Task not running from another task
In .Net 4.5
This methos add a task into a list.
//This method returns Datetime.
var task = Task.Factory.StartNew(() => ProcessPost(_blockSize), token);
tasks.Add(task);
And I want to run another ...
0
votes
0
answers
38
views
How to run a .net 4.5 app on local that has a website.publishproj file
I am trying to run an old .net app. I'm used to seeing .sln files but this project has a website.publishproj file.
I am able to build the project by right clicking the website.publishproj file and ...
0
votes
1
answer
60
views
WPF Custom Dictionary is NOT working after Windows Server 2019 and Windows 10 latest versions
We are running a old WPF application and due to some reasons stick with .NET 4.5 version only.
Using the following code, we are adding some custom dictionaries for every RichTextbox controls.
public ...
0
votes
1
answer
40
views
Do we need to migrate .NET assembly to use in Windows application which migrated to .NET 4.8 framework? [duplicate]
We want to migrate Windows application to Microsoft .NET 4.8 Framework and it uses assembly which running against .NET 4.5. Since it is used by multiple applications, we installed it into the global ...
0
votes
0
answers
66
views
Is there a way to convert byte into IFormFile c# .net 4.5
I have a project implemented in .NET 4.5, and for some reason, I cannot change it. I want to post a photo to a web API that is implemented with .NET Core. The API endpoint uses HTTP POST, and its ...
0
votes
2
answers
62
views
Assign values to Tuple with named values in inline function
I'm supporting a solution using VS 2022 and Framework 4.5.2.
I'm trying to create a tuple with named values inside an inline function and pass it to another function.
I know how to declare the tuple ...
0
votes
0
answers
40
views
Consuming GraphQL in .NET 4.5 project using C#
I have an ASP.Net 4.5 project that has a new integration requirement to read data from GraphQL and do some logic.
I've tried searching in google and documentation but couldn't find anything that helps ...
0
votes
0
answers
72
views
I need to use hangfire in ASP.NET MVC
I need to use hangFire in ASP.NET MVC but I can't call backgroundService in ASP.NET MVC.
enter image description here
In .NET Core, I register it in the Startup file:
builder.Services.AddHostedService&...
0
votes
0
answers
33
views
How to modify treeBuilder.Dot to generate LEFT JOIN instead of INNER JOIN in custom function generator for NHibernate?
Im trying to extend LINQ to NHibernate provider for my custom function. The problem that I found is that, whenever I try to access a FK from my entity, it generates a "INNER JOIN" statement, ...
0
votes
0
answers
49
views
Telerik controls are not loading properly after windows upgrade
Recently I have migrated a website which was running on Windows server 2012 R2, .Net Framework 4.5 and IIS 7 to Windows Server 2022, .Net Framework 4.8 and IIS 10. I did the migration by creating a ...
0
votes
1
answer
60
views
CS2034 Error The type or namespace name 'DataAccessLayer' does not exist in ASP.NET MVC 5 project
I have an ASP.NET MVC 5.2.9 project in VS2019 using Entity Framework 6 and running on .NET 4.5.2.
Everything has been working fine until recently when I did a minor "Update Model From Database&...
0
votes
0
answers
65
views
Resizing of tabpage content
I have a winform application, with multiple dockable forms.
In one of the dockable forms, i am seeing a resize issue of the content (described below), the document outline of which is as follows:
...
1
vote
1
answer
48
views
C# Namespace 'ServiceModel' does not exist in namespace 'System'
I have been searching the forum for answers to my problem but unfortunately the proposed solutions have not worked for me.
I have a project (Classes library .NET Framework) with the reference to the ...
-1
votes
2
answers
66
views
Display N numbers of table in ASP.NET webform based on user input
I want to display N numbers of table in ASP.NET webform based on user input.
For example,
user input -> PDO123045,PDO122111
In this case, user input two values seperated by commas, so if I split ...
0
votes
0
answers
165
views
HttpClient - Get data without async
I have HttpClient code which is supposed to download a PDF/Word document from given URL (SSRS report) and convert it to a memory stream but that is not working for all cases.
Sample URL:
http://server/...
0
votes
2
answers
98
views
Convert a byte array which is a zip file back into a zip file
I am downloading a zip file that is stored in GitLab using below code:
using (HttpClientHandler handler = new HttpClientHandler())
{
ServicePointManager.Expect100Continue = true;
...
0
votes
0
answers
17
views
HttpClient SendAsync error: The request was aborted: Could not create SSL/TLS secure channel [duplicate]
I am trying to upload a file to Gitlab by using the following curl command via Package API.
curl --header "PRIVATE-TOKEN: mytokenhere" --upload-file myFile.zip https://my.gitlab.com/api/v4/...
0
votes
1
answer
124
views
Send an empty message instead of Embed Discord.Net
I stated my problem in the title.
code:
public static async Task Whois(SocketSlashCommand command)
{
var guildUser = (SocketGuildUser)command.Data.Options.First().Value;
var roleList = string....
0
votes
0
answers
56
views
Placing a conditional in XAML throws System.Windows.Markup.XamlParseException exception in the InitializeComponent method at run-time
I am trying to apply conditionals in the XAML code directly depending on the build configuration.
For example, I would like a piece of XAML code only put in the view in case of a Trial build ...
3
votes
1
answer
518
views
Forward Server-Sent-Events from another service to the caller - C# ASP.NET WebApi
I have a web app made with ASP.NET (constrained to .NET 4.5) using the WebApi which has a controller class.
In this controller, I had to make two new endpoints who have to call another service which ...
1
vote
0
answers
66
views
Send and Receive XmlDocument on .Net 4.5.1
I have to send a XmlDocument to an API on Framework 4.5.1.
In the sending API, I tried to send, via POST, the xmlStream using MultipartFormDataContent:
var multipartContent = new ...
0
votes
0
answers
129
views
How to secure .ASPXAUTH cookie value so that someone can't get access to the application by copy paste that value from one browser to another
My project is based on MVC 4 and .NET Framework 4.5.
By copying the .ASPXAUTH cookie value, anyone can log in from another PC or another browser. Even after logging off from one browser the .ASPXAUTH ...
3
votes
1
answer
640
views
Protect sensitive data in-memory using C#
I have a C# application which initializes some variables with sensitive data. They are not password, but we consider them sensitive though. The variable values I want to protect are all of string type....
0
votes
1
answer
315
views
How to solve error "aspnet_compiler.exe" exited with code 1 when trying to publish web service in Visual Studio 2019?
I have made a change to a web service in Visual Studio 2019 and although it builds it throws an error when I try to publish. The web service is built on .Net Framework 4.5.1, and the error I'm seeing ...
1
vote
0
answers
160
views
How to setup .NET 4.5.x in GitHub actions windows runner
I'm trying to implement CICD for a .NET framework project which is based on .NET 4.5.x but GitHub actions setup/dotnet is not working as it couldn't find 4.5 in dotnet release index
I've tried to look ...
0
votes
1
answer
369
views
FluentValidation and .NET 4.5
I've just installed FluentValidation 11.5.1 for my project which uses .NET 4.5 but I can't install FluentValidation.AspNetCore due to incompatibility with my .NET version. After doing some research I ...
0
votes
2
answers
157
views
c# Nunit .Is.EquivalentTo not behaving as expected for a List<T>
I am using NUnit in .net 4.5.2 project
Using the Collection assertions thusly:
Assert.That(first, Is.EquivalentTo(second));
This unit test passed
[Test]
public void ...
0
votes
0
answers
42
views
GetRepository(), CreateRepository(), DeleteRepository() methods no longer exists in Nest 7.x, how to use them?
I upgrade my project from .Net 4.5.2 to .Net 4.8.1 and of course nuget package "NEST" upgraded too.
In the NEST 7.X version we don't have anymore the next methods: GetRepository(), ...
0
votes
0
answers
42
views
How to make copy of IWebProxy?
If I do:
var proxy1 = WebRequest.GetSystemWebProxy();
proxy1.Credentials = new NetworkCredential("admin", "pass123");
var proxy2 = WebRequest.GetSystemWebProxy();
proxy2....
0
votes
1
answer
73
views
Video rendering issue in WPF when moving window between monitors with different screen resolution and/or scale
I have a winforms application (well, it is an VSTO Outlook Add-in that runs within Outlook) in which I am using a toolbar and within this toolbar I embed a WPF user controls through the use of an ...
0
votes
1
answer
220
views
Error BC30002 being thrown on publish but not build
I have an asp.net website I have been working on in Visual Studio 2019, using .Net Framework 4.5.1. The code builds just fine but won't publish, giving me this error:
Error BC30002: Type 'DataTable' ...
3
votes
3
answers
429
views
Saving settings/variables/permissions in memory instead of looking them up on each API call?
I have an API set up that allows placing orders, looking up product info, reporting, etc. Each API key has specific permissions on which controllers/methods they can or can't access, as well as fields ...
-1
votes
1
answer
416
views
How to set SetWindowsHookEx only on a specific window to listen for mouse left button up events
I am trying to get when the left mouse button up is hapenning on a specific window. So I googled and find an interesting code snippet here.
That code snippet detects in which window the mouse click ...
0
votes
0
answers
34
views
Viewbox scales things too small at high resolutions and scale factors and they are virtually impossible to see
I have a grid with one row and some columns. In order to scale correctly the grid content according to the screen resolution and scale selected in the Windows OS, I use a Viewbox.
I also define a ...
0
votes
1
answer
51
views
Viewbox interfering grid columns horizontal alignment
I am using a Viewbox with Stretch set to Uniform in order to not distort the content when user switches between screen resolutions and scale in the OS.
Within the Viewbox I have a grid.
The grid has ...
-2
votes
2
answers
298
views
Create dependency property for WPF Window itself in its code behind xaml.cs
I have a WPF window which I have changed its borders, title bar and buttons for a custom one. Separately in a ResourceDictionary I have defined the Style that I want to apply to my WPF window.
Then I ...
0
votes
1
answer
282
views
System.Windows.Markup.XamlParseException:''Provide value on 'System.Windows.StaticResourceExtension' threw an exception when applying style to Window
I am trying to apply a style to a particular WPF Window in my application, not to all window.
Basically I want to change the style just because I want the window header bar to look different.
I have ...
0
votes
0
answers
71
views
ElementHost does not resize appropriately to its content
I have an ElementHost which contains an WPF user control.
For some reason that I don't know, the ElementHost is not being resized to the user control when it changes its height.
My ElementHost has the ...
-1
votes
1
answer
133
views
How to make some parts of a string to be bold and with different font style (size, font weight) within a WPF RichTextBox
I have below WPF RichTextBox which is bound to an MVVM property in my view model.
The property SampleText contains a string, let's say, e.g.:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, ...
0
votes
0
answers
97
views
Accepting DataTable changes in a DataGridView_RowsRemoved event handler throws IndexOutOfRangeException
I have a DataGridView that is bounded to a DataTable datasource:
this.ImdToImportDataGridView.DataSource = this._imdToImportDataTable;
I allow users to delete lines, one at a time, by pressing DEL ...
0
votes
1
answer
137
views
How to setup VMware Tanzu TAS on Azure to deploy .Net 4.5 application
I am new to Azure and TAS (https://tanzu.vmware.com/application-service) and want to deploy .Net 4.5 web form application using VMWare Tanzu TAS (previously Cloud Foundry) on Azure.
I got Azure ...
1
vote
2
answers
274
views
Thread or Task (stopping a hung single line of code)
New to Threading/Tasks and async processing...
I have a process that attempts to acquire a file, however, if the file is pwd protected, the call to GetDocument never returns, and hangs the service.
In ...
0
votes
0
answers
29
views
Strange issue when no breakpoint is set when calling SslStream.AuthenticateAsServer
I am adding some code to a legacy application running .net 4.5.2. I copied some code from .net 4.8 solution for decrypting the Ssl Stream. My Code works fine when I have a breakpoint right on or right ...