Questions tagged as '.net'

1
answer

Error debugging by null on connection

I want to document a unit test but I'm getting an error:    System.Exception: 'Error closing database connection: Object reference not set to an instance of an object.' My test case has been coded as follows: using System; using Microso...
asked by 17.11.2018 / 23:09
1
answer

The remote server returned an error: (400) Incorrect request

I have created two methods, one for authentication via certificate type A1 and A3 and another to send an xml, both of which make the request in a client apiect. In the authentication method, I send the data from my certificate to the client a...
asked by 27.04.2018 / 15:45
1
answer

Check for null or empty fields in an entity without consecutive use of "if-else"

In an integration between systems there are data updates on both sides, where the A-side record and the B-side record are obtained. If there are null fields in A and these exist in B then A is complemented with B the reverse is also true, it's l...
asked by 06.10.2017 / 16:00
1
answer

Error reading text file line by line

I'm trying to read a very large file line by line and adding to a list, however when it arrives at a certain point I get an error: System.OutOfMemoryException Is there any way to read this whole file in one go? while ((line = trPlace...
asked by 30.09.2017 / 20:25
1
answer

C # - Use form data in IF

I'm trying to retrieve data from the form and need to use it in an IF. protected void btnSubmit_Click(object sender, EventArgs e) { try { if (txtLocalizacao.Text != "") { conn.Open(); SqlCommand...
asked by 30.06.2017 / 21:19
1
answer

TimeSpan Conversion

I'm reading a file delimited by a semicolon and one of the information that is the duration of the link is coming as "00:97:54". When trying to convert to TimeSpan, it obviously gives error    The TimeSpan could not be parsed because at le...
asked by 19.05.2017 / 18:31
1
answer

Generic Method for REST Query

I need to refactor this method to make it work better. This method works flawlessly when calling an external API Rest return list. However, it gives an exception when the external API return object Rest returns an element only. publ...
asked by 24.06.2017 / 22:03
1
answer

Working with sound in .NET

In .NET, it is relatively easy and simple to work with images. It is possible to use the System.Drawing.Bitmap class to open images in Bitmap, Jpeg and PNG formats and play with their pixels. The code below, for example, gets any image an...
asked by 18.07.2017 / 14:03
1
answer

Automatic expiration cache time

I am using the function below to store the cache was working normal, but now when add the time of 60min is as if it expired automatic, now if I enter a time greater like 181min the cache is maintained. If anyone can help me, I'm grateful. H...
asked by 17.07.2017 / 22:50
1
answer

Open ASP.NET project that is coming from another machine

I have a project that was created on a machine and I have to maintain it. I copied the project to my current machine and when I try to open the solution / project I get the following message from Visual Studio:    link : error: Error open...
asked by 14.06.2017 / 18:04