.NET Programming

134K

Solutions

39K

Contributors

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

I have some domain names (my manager came up with them). How can I tell if they've already been registered/taken by others? do I need to check with GoDaddy?
0
Hi

Can someone suggest the best way to read and write a  simple JSON file and get at the compontes?

config.json

{
	"config": {
		"url": "https://example.com/thread1234",
		"lastpage": "183"
	}
}

Open in new window



This fails because it wants a stream not a file  From Here
using System.IO;
using Newtonsoft.Json;

namespace RW_JSON
{
    class Program
    {
        static void Main(string[] args)
        {
            string JSONPath = @"H:\temp\config.json";
            if (File.Exists(JSONPath))
            {

                JsonTextReader reader = new JsonTextReader(new StringReader(JSONPath));
                while (reader.Read())
                {
                    if (reader.Value != null)
                    {
                        Console.WriteLine("Token: {0}, Value: {1}", reader.TokenType, reader.Value);
                    }
                    else
                    {
                        Console.WriteLine("Token: {0}", reader.TokenType);
                    }
                }
                Console.WriteLine();
            }
        }

    public class Config
    {
        public string Path { get; set; }
        public string url { get; set; }
        public int lastpage { get; set; }
    }
    }
}

Open in new window

0
Hi,

I have a following JArray object:

{[  {    "NumberType": 9,    "Address": null,    "Contents": {      "NumberType": 0,   "Stars": null,      "Sleep": null,      "Body": {        "NumberType": 0,        "Layout": 1,        "Contents": [          {            "NumberType": 0,            "Contents": [              {                "NumberType": 7,                [b]"Text": "Isabell.jpg"[/b],                "CSS": null,                "Margin": null,      "Weight": 1,                "Color": null,                "HW": null              }            ],            "CSS": null,            "Padding": null,            "Margin": 2,            "HW": null          }        ],        "CSS": null,        "Padding": null,        "Margin": null,        "HW": null      },      "Footer": {        "NumberType": 0,    "Contents": [          {            "NumberType": 1,            "HW": {              "NumberType": 2,              "Label": "Open",              [b]"imageUrl": "https://myPic.jpg" [/b]           },            "CSS": null,            "Margin": null,            "Height": 0     }        ],        "CSS": null,        "Padding": null,        "Margin": null,        "HW": null      },      "Styles": {        "Stars": null,        "Sleep": null,        "Body": null,        "CSS_Spec": {          "BackgroundColor": null,          "Margin": true,          "MarginColor": null        }      }    },    "TextMessage": "GoodMorining"  }]}

Open in new window


Using Json.net, I want to extract the value of "Text" and "imageUrl".
I tried to use SelectToken method. SelectToken worked fine with a simple JArray element, but not with this nested one.

Can you please tell me how to get the value of the specified key?
0
The attached application -which I built using Model View Presenter MVP Pattern- does not work as expected. It does not show the navigation menu.

I debug the application: it takes me to the following .cs source code file:
ResolutionExtentions.cs

Please help ASAP.

Thanks,
MVP.zip
0
Is it possible to use SSRS 2016 reports in a ASP.Net Core Web Application?

If so anyone have a link to an example?
0
I am working with a program that is written in Progess. The specific aspect of the program I am working with is making a call of some sort to the file system which returns a listing of the files that match the request. A DOS example would be:

dir d:\xyz\12-123-1234*.* /s

My first question is this: Is it possible to capture a log of the file system calls being made by this program.

My next question is, if the first answer is yes, is it possible to modify how the file system interacts with this call?

What I am really trying to accomplish is to split a parent folder into about 50 sub folders, so all file calls to d:\xyz\ that began with 12 would point to one folder, 13 to a different folder. The underlying problem is that the programmer is dead, and the program cannot be modified, and we don't have the source code to rewrite.
0
Please help me understand why C# throws this error when there's already a return statement there? I can add another return to fix it but why does it do that?

ee1.png
This is how I can fix it

public decimal CashBonusBalance
		{
			set {this.label_CashBonusBalance.Text = string.Format("{0:C}",value);}
            get
            {
                if (label_CashBonusBalance != null)
                    return decimal.Parse(label_CashBonusBalance.Text);
                return 0; //**** adding an extra return
            }
        }

Open in new window

0
I started using telerik controls and cannt find enough examples for the starter...

Im using unbound radListView control and need to convert this code from vb6:
  If ListView2.Items.Item(i).Name <> ListView2.FocusedItem.Name

what is the equivalent of radlistview for FocusedItem ?
0
Hi, I have requirement to use Kerberos authentication for ASP.NET WebAPI application deployed in Docker Swarm .NET Core linux containers. WebApi will be used by web clients with Kerberos support. Application also should be connected to active directory to subscribe and get list of all users from AD. Docker Swarm deployed on premises in the organization network. Anyone have experience with such configuration?
- What should be done to enable Kerberos authentication in the ASP.NET and its Docker linux image? Will this require 3rd party kerberos tools or it can be handled by .NET Core?
- To enable such configuration what should be configured in the SWARM cluster?
- What should be used as service principal names (SPN)? And how to get user AD Identity inside ASP.NET?
- Is it possible to use multiple container instances of the same application?
- How I could use background worker service inside SWARM cluster to sync users list with the AD database?
0
how to write a VBS script  in windows server executing below list of commands to run through  windows admin console

===
title ADF-SERVER
SET USER_MEM_ARGS=-Xms24576m -Xmx24576m -XX:PermSize=10240m -XX:MaxPermSize=10240m
C:\Oracle\Middleware\user_projects\domains\ABC\bin\startManagedWebLogic.cmd ADF-SERVER

================
0
I want to develop codes to ping my backlinks to Google.
using c# and mvc.

can you show me to do that?
0
From my website. I need to allow user to be able to delete files from a shared folders.  How do I impersonate a non-windows account? I need to connect to a multiple Linux shared folder. so I do not want to map a drive letter. I currently use the below command, but I do not want to show my user name and password. I'm able to get the command below to work with impersonate with my windows account but .net impersonate does not work on non-windows accounts.  I need a solution that will let me connect to a shared folder using a non-windows account.

Example: I'm using the .Net ProcessStartInfo.Arguments Property

startInfo.FileName = "net";
startInfo.Arguments = "use \\\\Servername\serverPath serverPassword /user:serverUsername";
Process.Start(startInfo);
0
Hello EE community,

We host over 600 sites in a farm of 6 servers and on a monthly basis we do a deployment that will overwrite the DLLs in a folder called \BIN which is a centralize point for the binaries of all the site folders. We have a symbolic link to the \BIN folder under each site folder. During the deployment, we run a script on all 6 servers, that will stop IIS, overwrite the DLLs in the \BIN directory then start IIS. The minute this happens, the CPU spikes to a steady 100% which could last up to 3-4hours on all the servers once the first request comes in for each site. I understand that it goes through a "warm-up" process on the first hit x 650 w3wp.exe processes running = CPU spike. The way we get around this is by restarting the servers.This happens on every deployment. Is this normal?  If not, how could I troubleshoot this issue to find out what is causing this.

Antivirus has the necessary exclusions.
0
4.jpghi expert

the update service references operation in visual studio
how to do delphi (rad studio )?

how to update service references operation  in delphi?
0
Hello,

We host over 600 IIS sites and after a framework deployment by the Web Developers, the CPU goes through the roof after IIS is started. What we would like to do is start IIS, stop all the sites, then start them up in batches (for example, 50 at a time) to see if it helps with controlling the CPU usage. Could someone assist with a powershell script that will start up sites in batches?

Import-Module WebAdministration
Get-ChildItem -Path IIS:\Sites | foreach { Stop-WebSite $_.Name; } "Stops all sites"
0
I need to get Certificate Info from a PDF Form.  Not sure how to do this with iTextSharp.

Here is some sample code:

[HttpPost]
        public ActionResult Upload(HttpPostedFileBase file, string Name)
        {

            if (file != null && file.ContentLength > 0)
            {
                    string pdfTemplate = "NewRequest.pdf";
                    byte[] pdfbytes = null;

                    BinaryReader rdr = new BinaryReader(file.InputStream);
                    pdfbytes = rdr.ReadBytes((int)file.ContentLength);
                    PdfReader reader = new PdfReader(pdfbytes);
                    //PdfReader _reader = new PdfReader((byte[])file).ToArray();

                    string t = Name.Trim().Length == 0 ? null : Name;
                    var fields = reader.AcroFields.Fields;
                    var RequestID = reader.AcroFields.GetField("requestId");
                    CultureInfo MyCultureInfo = new CultureInfo("en-US");
                    var OpenDate = reader.AcroFields.GetField("openDate");
                    DateTime? OpenDate2 = null;
                    try
                    {
                        OpenDate2 = DateTime.ParseExact(OpenDate, "d/M/yyyy h:mm", MyCultureInfo);
                    }
                    catch
                    {
                        OpenDate2 = null;
                    }
                    var Org = reader.AcroFields.GetField("organization");
                    DateTime? NeedDate = 

Open in new window

0
I read this article that says the release date of asp.net core 3.0 would be announced at the Microsoft Build conference.
https://visualstudiomagazine.com/articles/2019/04/19/net-core-3-preview-4.aspx?m=1

I did not attend the conference.

Anyone know the release date?
0
I am trying to use .net assemblies to interact with LDAP server <Sun Open LDAP > to create as entry/records. I wrote this below code, but it is giving error:

#Load Library.
$null = [System.Reflection.Assembly]::LoadWithPartialName('System.DirectoryServices.Protocols')
$null = [System.Reflection.Assembly]::LoadWithPartialName('System.Net')

# LDAP Connection to LDAP Server.
$LDAPDirectoryService = "LDApServer.domain.com"
$DomainDN = "ou=mailalias,ou=person,o=domain,c=us"
[string]$Mailalias = "test123"
$user = Read-Host -Prompt "Username"
$pass = Read-Host -AsSecureString "Password"
$credentials = new-object "System.Net.NetworkCredential" -ArgumentList ($user,$pass)
$LDAPServer = New-Object System.DirectoryServices.Protocols.LdapConnection($LDAPDirectoryService,$credentials)
$LDAPServer.AuthType = [System.DirectoryServices.Protocols.AuthType]::Basic
$LDAPServer.SessionOptions.ProtocolVersion = 3
$LDAPServer.SessionOptions.SecureSocketLayer =$false

#Search Object
$filter = "(&(IDNUmber=$mailalias))"
$scope = [System.DirectoryServices.Protocols.SearchScope]::Subtree
$attrlist = ,"+"
$r = New-Object System.DirectoryServices.Protocols.SearchRequest -ArgumentList ($DomainDN,$filter,$scope,$attrlist)
$r | fl
$LDAPResponse = $LDAPServer.SendRequest($r);
write-host $LDAPResponse.Entries.Count


#Object Properties for creating LDAP Alias
$r = New-Object -TypeName System.DirectoryServices.Protocols.AddRequest
#$r.DistinguishedName = "cn=$Mailalias,$DomainDN"

Open in new window

0
What tools are needed for .net mobile device development and where can I find some really good tutorials?

I'm thinking Xamarin, since it's write once, and C#. Does it also allow VB.NET?

Thanks!
0
I want to generate a DocX file with footer from HTML.
The body of the document comes from HTML and I want to add a text to the footer.
I'm using the following lib: DocumentFormat.OpenXml

I manage to generate the DocX file, BUT without Footer.

The code that I use is the following:
class HtmlToDoc
{
    public static byte[] GenerateDocX(string html)
    {
        MemoryStream ms;
        MainDocumentPart mainPart;
        Body b;
        Document d;
        AlternativeFormatImportPart chunk;
        AltChunk altChunk;

        string altChunkID = "AltChunkId1";

        ms = new MemoryStream();

        using(var myDoc = WordprocessingDocument.Create(ms, WordprocessingDocumentType.Document))
        {
            mainPart = myDoc.MainDocumentPart;

            if (mainPart == null)
            {
                mainPart = myDoc.AddMainDocumentPart();
                b = new Body();
                d = new Document(b);
                d.Save(mainPart);
            }

            chunk = mainPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Xhtml, altChunkID);

            using (Stream chunkStream = chunk.GetStream(FileMode.Create, FileAccess.Write))
            {
                using (StreamWriter stringStream = new StreamWriter(chunkStream))
                {
                    stringStream.Write("<html><head></head><body>" + html + "</body></html>");
                }
            }

            altChunk = new AltChunk();
            

Open in new window

0
Is there a way to force a Control+F5 on a user? We publish our code and the style sheets look horrible until they do a control+F5, but other than putting a message on the screen, how do we trigger the style sheets to update?

thanks!
0
Hi,


I need to install Microsoft .NET Framework 3.5 on all Windows servers and I noted that there are some Windows 2003 are missing that version, they have Microsoft .NET Framework 2.0.

The reason why I need to install it is because a monitoring application required that to work.

My question is: Is there any impact to install it? I mean can this affect the applications already installed in the servers?

Thanks
0
I recently upgraded from jQuery 1.11.1 to jQuery 3.0.0 and now  a simple change on a couple of radio buttons no longer works. How can I get this back to working as it should?

    <script type="text/javascript">
       jQuery(document).ready(function () {
            j$('#cmdCreateNewEvent').prop('disabled', 'disabled');

            $('#rdoSameDonor').change(function () {
                EnableCreateButton();
            });
            $('#rdoDifferentDonor').change(function () {
                EnableCreateButton();
            });
        });

        function EnableCreateButton() {
            $('#cmdCreateNewEvent').removeProp('disabled');
        }
    </script>

Open in new window

0
We need to convert part of our MS Access DB to a web app.  ASPX or .net.  No experience in web apps.  Ideas?
0
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]
280
0

.NET Programming

134K

Solutions

39K

Contributors

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.