.NET Programming





The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Share tech news, updates, or what's on your mind.

Sign up to Post

We need to convert part of our MS Access DB to a web app.  ASPX or .net.  No experience in web apps.  Ideas?
Fundamentals of JavaScript
LVL 13
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

I am try to take a 1 dimensional array of data and transform it to display in X number of columns each with X number of rows for each page into a datatable to easily display as the sample below shows. I am not sure the best way to do this.

Just to test the example I want 3 columns per page, and each column will contain 3 rows with the sample data below there should be 2 pages with 3 columns and a 4 page will have only 1 col and 1 row of data remaining.

samplearray= "{"100","110","120","130","140","150","160","170","180","190","200","210","220","230","240","250","260","270","280"}"

Example Output:

[Page #1]

[Column #1]     [Column #2]     [Column #3]
100                     130                    160
110                     140                    170
120                     150                    180

[Page #2]

[Column #1]     [Column #2]     [Column #3]
190                     220                     250                    
200                     230                     260                    
210                     240                     270                    

[Page #3]

[Column #1]     [Column #2]     [Column #3]

I have the following code. How can I avoid foreach using linq?

foreach(var number in phoneNumbers)
	foreach(var i in number.key)
		if(students[i].phone == null)
			students[i] = new People { phone = number.Value };
			students[i].phone = number.Value;

Open in new window

please note
Dictionary<string[], string> phoneNumbers
List<People> students
Hi Experts,

I am running on dot net 4.6.1

I have the same problem described in the following question


Please help ASAP,

I'm looking for a bit of hand-holding on setting up, what I thought would be a simple project.
I am using Visual Studio 2017 .Net 4.7.
I've done some coding in c# long ago, but am more comfortable in vb.net.
I had previously done quite a bit of winform development, and only ever dabbled in web dev.  Since it's been so incredibly long ago, I would like to have some guidance on starting this from scratch.

I plan to have multiple progression questions on this and I'll attempt to keep it limited to simple steps throughout.
For the first question on this, however, I need to describe what I'm envisioning:

I will have a user visit this single web page. There would be a title with a button/link to click for more info (detailed instructions located elsewhere in our intranet).
Page load would read a sql database to pull down a list of memberships for this specific user (I do have the working code to accomplish this).
Those results are then placed into a list box (I thought a checkedlistbox would be best).  

The user is then given the following options:
A button, always available, to CREATE.
A button, only available if one, and only one item is selected, to MODIFY.
A button only available if one or more items are selected.  This button should present a confirmation, since this would be a delete process to occur.

I'd like to use bootstrap because I did spend a bit of time learning a bit about it, but I have very little knowledge on how to implement it into my code.
I recently had a pen test and one of the findings was our OWA (exchange 2013) is vulnerable to "Possible SQL Injection". Our pen tester recommends us to download the latest login dialog applet from Microsoft or recompile the web code against the v4.5 or later .NET framework. I am not able to find any download in Microsoft nor can I find any information regarding vulnerability or how to remediate it.

Has anyone encounter this issue before or know how to secure the OWA's logon page from SQL Injection? I read somewhere that it is not recommended to edit Microsoft's code.
Using Framework...
     ASP.NET Regular Web Form

Using Code Behind...
     VB.net & JavaScript & JQuery

My Issue...
I Need VB.code replacement for the following JavaScript Function --
(JavaScript Function may not be Syntactically Correct Since I Slightly modified its structure)
function myFunc(RBG) {
   var rbGrp = RBG; 
   var myVal;
   var radioButtons = document.getElementsByName(rbGrp);
      for (var x = 0; x < radioButtons.length; x ++) {
        if (radioButtons[x].checked) {
	     myVal = radioButtons[x].id);
             return myVal;

Open in new window

This JavaScript Function is PASSED the GROUPNAME of a group of Radio buttons...

It loops thru all the individual radio buttons of that Group of buttons via that GROUPNAME...

and ihen it should return the one radio button that was selected...

I need this in Server Side vb.net code instead of client side JavaScript code...

I have already laid out 35 Groups of Radio buttons each with 2, 3 or 5 individual choices -- already built in my ASP.net form so doing Radio Button List is now past as option

Any Experts have or can create this vb.net code equal to the JS code ??

thanks... CJ
I need the best practices on securing patients records inside the electronic medical record app I am developing. Ground from the database tier up to the presentation tier.
This kind of code delete all files in directory if cheked

          If chkDeleteSourceFiles.Checked Then
                For i As Integer = 0 To oFiles.Length - 1
                    Dim sFromFilePath As String = oFiles(i)
                    If IO.File.Exists(sFromFilePath) Then
                        Catch ex As Exception
                            txtOutput.Text += "No se puede borrar " & sFromFilePath &
                             ", " & ex.Message & vbCrLf
                        End Try
                    End If
            End If

Open in new window

That is a mess...
I need if is cheked only delete PDF files.
could you help me ?

I am a lab instructor at my university doing Data modeling and programming languages classes.

I need a roadmap for my students who want to learn .net programming using c# from zero to hero.

Topics, Curriculum, Frameworks, ....

Please help me and my students!
Become a CompTIA Certified Healthcare IT Tech
LVL 13
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

I need to use HTML encode to filter/scrub some data being read by my SqlDataReader object. Trying to prevent an XSS attack. I've never used HTML encode before but I need to apply it to code that looks like the following:

                        oReader = oCmd.ExecuteReader();

                    if (oReader.HasRows == true)
                        int iLastID = 0;
                        decimal total = 0;

                        while (oReader.Read())
                            if (iLastID != oReader.GetInt32(oReader.GetOrdinal("checktypeid_fk")))
                                sTableDetail += "<tr>";
                                sTableDetail += "<TD>" + oReader.GetValue(oReader.GetOrdinal("Description")).ToString() + "</TD>";
                                sTableDetail += "<TD>" + oReader.GetValue(oReader.GetOrdinal("Quantity")).ToString() + "</TD>";
                                sTableDetail += "<TD align=right>$" + oReader.GetValue(oReader.GetOrdinal("Amount")).ToString() + "</TD>";
                                sTableDetail += "<TD align=right>$" + Convert.ToString(Convert.ToDouble(oReader.GetValue(oReader.GetOrdinal("Amount"))) * Convert.ToDouble(oReader.GetValue(oReader.GetOrdinal("Quantity")))) + "</TD></TR>";

Open in new window

I'm getting some file info in my application and i'd like write them if have relative directory relationship in my application.

For example my directory: C:/files

If it's found file in;
C:/files/test1.pdf    'Output: ../test1.pdf
C:/files/190501/test2.pdf 'Output: ../190501/test2.pdf
C:/archive/180501/test3.pdf 'Output: C:/archive/180501/test3.pdf

I search on net and Path.GetRelativePath would fit my desire but it's not supported at .net 4.8 so Any help would be grateful.

I am trying to call a stored procedure in C# that contains both SELECT statements and PRINT statements. I've managed to get the PRINT statements back by way of a SqlInfoMessageEventHandler, but that doesn't help since there are SELECT statements mixed in that contain information pertaining to the PRINT statements.

The other fun part of this is that the SELECT statements all have varying #s and names of columns.

All I really want to do is capture all of that output into a string variable (kinda like executing the stored procedure in SSMS with the query results being output as text.

Changing the Stored Procedure isn't possible.

Is this possible?
I am developing on-premise Electronic Medical Records (EMR) app for a clinic.
I architected the solution using Domain Driven Design approach combined with the following architectural styles:
  • Layered architectural style: for structuring the solution and separation of concerns
  • 3-Tier architectural style: for deployment
  1. Database tier: Sql Server database
      [list=2]Application server tier[/list];
      [list=3]Presentation tier as a desktop app[/list].
  • SOA architectural style: for the communication between the desktop app and the application server; Where the application server exposes the business services.

I have the following error on the application server when I tried to access the WCF security service from the web browser:

"The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."

Attached the solution source code.
WordPress and Azure?

I hope to create a WP site as a hobby, since I just never got around to learning PHP. But, as a .NET Developer, I also want to get my hands dirty with Azure.

Does it make sense to do this? Eventually, I would expect to host the WP site, but have no idea of what it might cost to so this. I mean, host WP on Azure.

Any idea what it might cost for a low-traffic WP podcast hosted on Azure?

Or, if this is a really bad idea, please tell me.

I want to pass a datatable to a stored procedures.  I found the below article and have been using this as my template.


I created the below Type successfully but when trying to use it in the stored procedure I'm getting below error.

Msg 137, Level 16, State 1, Procedure POProcess, Line 31 [Batch Start Line 7]
Must declare the scalar variable "@POC".

How do I fix this?

	[id_PO] [int] IDENTITY(1,1) NOT NULL,
	[promisedDate] [datetime] NULL,
	[qty] [int] NULL

Open in new window

ALTER PROCEDURE [dbo].[POProcess] (
	@POC POComponentType READONLY
) AS

	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.

		UPDATE POComponent
		SET promisedDate =	@POC.promisedDate,
		qty =				@POC.qty
		WHERE id_PO =		@POC.id_PO


Open in new window

I have a general question about the effectiveness of encrypting column(s) in SQL.
So you have a column or more that you have encrypted during the creation of a table.  Prior, of course, you create a Master and Private Column Encryption keys.  
The encryption and decryption takes place in the .NET application that connects to the database.  The Private Key created in the SQL database is exported and imported onto the machine running the .NET application.

My question is this ..
What prohibits someone, a developer, with this certificate from creating their own .NET application to access the data in the encrypted columns of the database, if they have access to that database; for instance a DBA.  The whole idea is not only encrypt the data from unauthorized access; but to also keep DBA's from viewing it as well.
I had this question after viewing socket connect() & bind() together?.

I am an old VB6 programmer and I am trying to create a windows desktop app that communicates with a Linux server over TCP or UDP sockets.  I just downloaded .Net Community 2019 and I can't find anything on sockets for VB.net, just C#.  

How can I get the functionality of VB6 winsock.ocx in VB.net?
I am developing an application which takes a root directory, finds all sub directories created the prior day, then adds to a List all of those directories that contain a file with a specific filename.

I was researching the fastest way to do this and came across PLINQ. PLINQ is new to me so I'm not sure if I'm missing something important. Am I using PLINQ correctly?

static void Main(string[] args)
            List<FileInfo> processThis = new List<FileInfo>();

            //List<string> paths = new List<string>();
            Stopwatch stopWatch = new Stopwatch();

            DirectoryInfo root = new DirectoryInfo(@"\\server\Shared\CC\Jobs");

            var dirs = root.EnumerateDirectories().Where(x => x.CreationTime.Date == DateTime.Now.AddDays(-1).Date);

            Parallel.ForEach(dirs, dir => processThis.AddRange(dir.EnumerateFiles().Where(f => f.Name.Contains("LUADUHC1"))));


Open in new window

CompTIA Network+
LVL 13
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

I have the following winform.

Essentially I need to refactor this code as I am getting some bad behavior..please assist.

1) I was hoping to put a default value in each of these two combo boxes...something like select....basically some words so it doesnt default to a real value.

2)  The form combo box updates the request dropdown.  
I need to better validate this ....and also the records just append on each call of the selected index change.  
I know somewhere i need to  clear this object.

3)  It would be cool to have the option on the request ID combo to auto type in such a way that it gets filled by the selection of the form combobox and then you can auto type to get the results faster in the request combo box.

please help and any other best practices I would gladly appreciate.  

Here is complete code behind of form UI

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using InfoPathAttachmentEncoding;
using AttachmentsLibrary;
using System.Diagnostics;

namespace SP2007AttachmentArchival
    public partial class frmDownLoadAttachments : Form
        private StringBuilder sb = new StringBuilder();
        List<Attachments> attachment = new List<Attachments>();

        public frmDownLoadAttachments()



Open in new window

I have a microsoft Azure Storage Account, with a blob container.

I am storing different types of files in this account.  I have excel files, some zipped up xml files, a .net app, and some sql scripts.

Currently I have AD access to this storage account.

What I need to do is configure the best way for my IT team to access these files if necessary and be able to read the excel files and potentially download the other files if needed.

This will be a rare event but the game plan needs to be in place.

I am seeing things regarding API, and URL's but no idea at this point how to configure.  

Please help.   At this point I am not sure if I need more AD rights from my infrastructure team to configure this.

This will be a long time storage facility to archive some retention items in the company.

But should our Audit team need to see anything , IT will be called upon to retrieve.  

I want to setup something that will not require an Azure expert to view these files.

I also want to keep this inexpensive as some of these retentions are literally lifetime.
hi guys

The environment I'm working in has around 150+ servers. Our team have to apply patches and keep these servers updated on a regular basis which they haven't done as yet. Now, the issue we have is that these servers are not just owned by the infrastructure and security teams, as that would be easy to manage. But the business analysts, business intelligence and applications teams own a good percentage of these too.

I need to put strategies in place so that my team, infrastructure&security, ensures that when these updates are applied that the impact is minimised and that we don't suddenly have updates which affect the applications sitting on those servers and firefighting errors.

One of my ideas was to ensure that there is a testing environment. But if I did, would I then liaise with the development teams to replicate everything that is on the production environment onto their testing too and regularly? So that when they make changes to development, they do the same onto testing?

What is the approach you have found works best?

Thanks for helping
Access to XMLHttpRequest at 'http://someURL' from origin 'http://someURL' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

This is a call to a REST API controller action method. I enabled CORS on the top of controller like below:
[EnableCors(origins: "*", headers: "*", methods: "*")]
 public class TestController : ApiController

Open in new window

Also in the web.config:

        <add name="Access-Control-Allow-Credentials" value="true" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
        <add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE" />
		<add name="Access-Control-Allow-Origin" value="*" />

Open in new window

Any ideas please thanks.
I have a vb.net program that was done several years ago and has references to .NET 2.0. How can I change this to .NET 4?
.NET 2.0

We are facing some issues with performance, we cannot seem to process data fast enough.

Firstly what I would need to know is what we are trying is technically possible

I'm trying to process hundreds of thousands of records
each record takes approx 500ms to process due to things like hitting external API's

I'm only able to process 85-100 records per second

The server is in a datacenter, its am 8 cpu skylake cpu, however when the app runs it uses approx 140 threads, and cpu sits around 6%

The app is multithreaded and i've tried threads, threadpool, Async/await, parallel foreach/invoke etc, most of the 500ms is waiting for API's to respond.

My question is related to processing throughput with the given parameters
i.e. if it takes 500ms to process 1 record, (and its running consistently on 140 threads), does 100 records per second so like a near limit?

I know this question is tough to answer but I need to know is i should be focusing on code performance tuning or look at other solutions

.NET Programming





The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.