.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

How to add a reference to Microsoft.Web.Management.Server reference in my c# project?
0
Hi

I'm extracting links from html using HtmlAgilityPack  but i'm getting a lot of unwanted rubbish

I have a list of wanted hosts how might I filter the links against this list?

using System;
using System.Xml;
using HtmlAgilityPack;
using System.Text.RegularExpressions;

					
public class Program
{
	public static void Main()
	{
		var html =
        @"<body>
    <div class='content'>
      <div id='post_message_30829575'>
        <a href='https://example.com/foo/123adj'><img src='https://example.com/foo/123adj/thumb.jpg'></a>
        <a href='https://example.com/foo/bar'>Link to foo bar</a>
        <a href='https://wanted.com/foo/bar'>Link to foo bar</a>
        <a href='https://rubish.com/foo/bar'>Link to foo bar</a>
      </div>
    </div>  
  </body>";

        var htmlDoc = new HtmlDocument();
        htmlDoc.LoadHtml(html);
		string [] hosts = {"exasmple", "wanted"};

         var HTMLBody = htmlDoc.DocumentNode.SelectSingleNode("//body");
            foreach (var Node in HTMLBody.DescendantsAndSelf())
			{
				var linkNodes = Node.Descendants("a");
				foreach (HtmlNode linkNode in linkNodes)
				{
					HtmlAttribute link = linkNode.Attributes["href"];
					HtmlNode imageNode = linkNode.SelectSingleNode(".//img");
                                       // Don't need images
					if(imageNode == null)
					{
						Console.WriteLine("Link value: {0}", link.Value);
					}
				}
			}
		
		
	
	}
}

Open in new window

0
When using asp.net web forms or asp.net mvc and using a gridview or an html table holding a sql server table with large amount of records and you want to allow exporting of the data to pdf.
What solution or technology do you normally use to export the large amount of data to pdf quickly?
0
Hi,

I am having trouble to install .net framework 3.5 or 4.o  in Window 10 enterprise due to WSUS server we have.

Any suggestions are appreciated!

Thank you very much in advance!
0
Hi all
i got

cie as date
cie.ToString("dd/MM/yyy")

result

14/03/2019

I need

Jueves 14 de Marzo del 2019
trans

Thursday 14 of march of 2019

or some like that, the needment is that give me the day as text format
"thursday"

tsm experts
0
The code below works, but I don't need it to be long data.
I've tried replacing the "LONGTEXT" with "SHORTTEXT" but that just gave me an string error.

If strBomPartCount.Length > uintTableCurrentColumnCount Then
                oConn.Open()
                For columnIndex = uintOffSet To strBomPartCount.Length
                    oQuery = "ALTER TABLE PcbBom ADD COLUMN PnQty" & (columnIndex - 4) & " LONGTEXT"
                    oComm = New OleDbCommand(oQuery, oConn)
                    oComm.ExecuteNonQuery()
                Next
                oConn.Close()

            End If

Thanks in advance.
0
Hi,

I have following codes.
I have myCollection variable that contains all the Web elements.  I am using two paths using XPath and or('|') operator because I need different things from the objects that these two different paths gives.
From the elements from the first path(//div[@role='region' and //@my-label] ), I want to get Text properties.
From the elements from the second path(//button[@role='button' and //@my-label]), I want to get the values of 'my-label' attributes. (the Text properties for this elements are "")
After that, I want to put all these too myList<string>.
Obviously I am getting errors on my Linq query(at Select statement).
What's should I do to accomplish this?


public IReadOnlyCollection<IWebElement> myCollection => _driver.FindElements(By.XPath("//div[@role='region' and //@my-label]  | //button[@role='button' and //@my-label]"));

var myList = new List<string>();
myList = myCollection
                    .Select(a => a.Text or a => a.GetAttribute("my-label").ToString()) 
                    .Reverse() // Newest item first
                    .Where(a=>!String.IsNullOrEmpty(a))
                    .Where(b=>!String.IsNullOrEmpty(b))                              
                    .ToList();

Open in new window

0
Using Windows Forms

I have a tabcontrol , each page has a datagridview.  I know the  tab page name

tabData.SelectedTab.Name

let's say I have tabPage1  the datagridview on that tab is dgvPage1.   Now I want to get the selected row

int row = dgvPage1.CurrentCell.RowIndex;  


How can I do this if all I know about is the grid I want is   -- String  VariableName  =  "dgvPage1"  stored in a variable.

int row = (VariableName).CurrentCell.RowIndex;  
String Person = (VariableName).Rows[row].Cells[0].Value.ToString();
0
Hello,
I am getting below error :
 
System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
   at System.Data.SqlClient.SqlBuffer.get_Int64()
   at System.Data.SqlClient.SqlDataReader.GetInt64(Int32 i)

Open in new window


This comes on line row[7] where it is assigning Date value. This is assigning to DataRow in Datatable , Please help.Thanks I checked there are data available in reader there is nothing like NULL for data. There is data present.


                    while (dr.Read() == true)
                    {
                        
                        if (Uid!= dr.GetInt32(0))
                        {

                            row = table.NewRow();
                            rectificationId = dr.GetInt32(0);
                            row[0] = dr.GetInt32(14);
                            row[1] = IdTest; 
                            row[2] = dr.GetString(1); 
                            row[3] = dr.GetInt32(2); 
                            row[4] = dr.IsDBNull(4) ? 0 : dr.GetInt32(4);                           
                            row[5] = dr.IsDBNull(6) ? string.Empty : dr.GetString(6); 
                            row[6] = dr.GetString(11); 
                         [b]   row[7] = new DateTime(dr.GetInt64(12)); [/b]
                            row[8] = new DateTime(dr.GetInt64(8)); 
                            row[9] = new DateTime(dr.GetInt64(9)); 
                            row[10] 

Open in new window

0
Hi

I have a few user settings in my vb.net project. The problem I am having is that they are not updating when I save them. The settings are set in user in the project properties. My code is:

        My.Settings.ServerIPAddress = txtServerAddress.Text
        My.Settings.ServerUserName = txtServerUser.Text
        My.Settings.ServerPassword = EncodeServerData(txtServerPassword.Text)
        My.Settings.Save()

The problem is in the following:

            If My.Settings.UpdateSettings = True Then
                My.Settings.Upgrade()
                My.Settings.Save()
            End If

I use this so that when a new version is installed I get the old settings. I need the best of both worlds the user to be able to change the settings and them being preserved when new versions are installed.

Any help would be appreciated

Nick
0
Hi All,


I want to develop a application for starting and stopping VMs , it will utilise Azure powershell . should I use powershell and wpf or c# and wpf, if I develop in c# the guide interface, can I call powershell commandlets? is c# more flexible for developing wpf guis than powershell?

thank you in advance,
kelly
0
Need Sitecore and .NET MVC practice site

I will be placed on a client location in a few weeks and at that time will be granted access to the existing Sitecore database. Until then, I need some hands on practice with Sitecore.

First, what is the correct term for a Sitecore file? It's not a database, but what term do you use to describe it?

I will be using Sitecore with .NET C# MVC.

I have Visual Studio installed and SSMS, but may need to put on SQL Server as well.

What can you suggest? I will also have no access to the source code until I am at the client location, so I just need something akin to a sandbox where I can play around. An existing, working MVC site with an integrated Sitecore demo database would be best.

What can you suggest?

Thanks
0
Have a vendor product CT FreightRater, an automated rating database used to calculate rates for loads we haul. We can enter hundreds of scenarios for rates like mileage, flat rate from point to point.
FreitRater recently did a changeover from running their WebService using XML, to using JSON. I have my JSON data conversion code ready, but need assistance setting up the front parameters that allow the HTTP URL, validation, etc.
In my RPGLE program, I use a product called RPG-XML Suite from Krengeltech. It supplies API's I can use to formulate my data into the JSON format, and that's working fine.
I can test through a program on the FreitRater Server called 'MultiRater'. This allows me to 'drop' in formed JSON statements to test against the rating database, and receive a response.
Unfortunately, FreitRater is unable to provide the specs for what these parameters are.
The only example I received from them to allow testing sending a RatingRequest example (C# .NET), is attached.

I'm also including the RXS_TransmitDS_t data structure used to 'send' to the FreitRater WebService in an attachment.

I need a 'translation' of sorts between the C# .NET example, to be able to  plug in those parameters to the RXS_TransmitDS_t data structure.

How-to-send-a-RatingRequest-Example-.txt

RXS_TransmitDS_t.txt
0
Hi,

I have an rdlc report in Legal papersize. I have set the report properties to Legal. The problem I am having is when I load it in to the reportviewer  and go to print the pagesize under page setup is always set to letter so it has to be changed manually. I need to be able to set the page settings in reportviewer programmatically so I can switch between letter and legal sizes via the code.  I have tried various things but nothing seems to affect the page setup dialog. What is the correct procedure to do this. I am coding in vb.net.

Thanks

Nick
0
Tips to mastering Sitecore

I have a rare opportunity to invest lots of time into learning Sitecore, in preparation for a job integrating Sitecore with a .NET MVC application. So, the more I learn now, the further I can go in implementing Sitecore.

What videos and topics can you suggest I did into to make the most out of this one month deep dive into Sitecore.

And what related technologies might I also consider?

Thanks
0
Hi,

I have JSON string looking like this:
{  
   "status":"success",
   "result":{  
      "0":{  
         "id":115718,
         "sender_id":12464,
         "due_date":"0000-00-00 00:00:00",
         "language_id":"sv",
         "last_event":"2019-03-07 14:42:59",
         "visible_name":"PurchaseContract_100",
         "name":"PurchaseContract_100",
         "reminder_dates":"0000-00-00 00:00:00",
         "offer_status":4,
         "offer_type":1,
         "user_details":"{\"first_name\":\"Webcars Logistik\",\"last_name\":\"\",\"company\":\"Webcars\",\"email\":\"logistik@webcars.se\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\",\"reg_no\":\"\",\"address\":\"\",\"telephone\":\"\",\"post_code\":\"\",\"city\":\"\"}",
         "unique_id":"5c811fad442af",
         "created_date":"2019-03-07 14:42:05",
         "signed_date":"2019-03-07 14:42:59",
         "last_sent_emailreminder":"0000-00-00 00:00:00",
         "last_sent_smsreminder":"0000-00-00 00:00:00",
         "unread_notification":1,
         "offer_rejected":0,
         "recieved_by":0,
         "overview_deleted":0,
         "bcc":"",
         "recipients":"[{\"email\":\"nordberg.peter@gmail.com\",\"full_name\":\"MUSICCENTER SKARA AB\"}]",
         "link_template":"",
         "is_shared_doc":0,
         "verification_sent":1,
         "expire_notification_sent":0,
         "due_notification_sent":0,
         "contract_chat":0,
         "thumbname":"",
         "thumb":1,
         "video_link":"",
         

Open in new window

0
Hi,

I need a versatile asp.NET Content Management System which can be used for various websites and web-apps, for instance...

- Brochure sites.
- Knowledgebase sites.
- E-Commerce sites.
etc...

I need a widely used CMS which has strong community/support base and lots of extensions/add-ons.

I don't mind paying a premium if the solution works.

Please can I have some recommendations.

Many thanks
0
I had an interview a couple of weeks ago and the guy asked me why APIs are called Restful. I said because they're stateless. I said with Web APIs, data is transferred via HTML and it can be XML , JSON, but Web Services can only be XML. (Something like that... of course I was nervous)

I didn't answer his question. I've been googling and reading about APIs for another interview I have today. What's the answer to that question?
0
Need a sample SQL Server database I can use to play around with

I have SQL Server 2014 installed and hope to goof around with a sample database which has lots of different object types already installed. In fact, I hope that

sys.objects table is filled with every possible permutation. I want this database for the sole purpose of raising questions in me about what things I may have not seen before.

Do you have a link so such a free database for me to download?

Thanks.
0
Please provide a list of SQL Database Objects

I am curious about whether "SQL Database Objects" makes you think of scripts, stored procedures, functions, views and triggers. Or, if there is a set of objects I may have not worked with yet.

Please confirm that those which I listed are in fact "SQL Database Objects" or list any that come to mind.

Thanks.
0
Does MVC.Razor have a future?

How do Angular and React co-exist with Razor? Or is it a binary choice?

Either, MVC.Razor OR Angular OR React?

Curious.

Thanks.
0
Any advantage of EF6.CodeFirst on a static database?

I have used Code First on a new project, and it rocked. Once the migration scripts are created, the database gets updated whenever it's out of sync. Awesome!

I have also use Entity Framework on a database that was not allowed to change, in any way. For this, I did NOT use Code First.

But, I recently watched a video on Udemy which said even in my second case, the Code First can still save time.

Is this true?

Id so, please explain why this is the case.

Thanks
0
Pros and more Cons of using SASS on a new MVC website?

I have not used SASS but hear it produces perfect CSS files. One downside is that everyone who needs to create classes must learn the SASS scripting language. Another may be that debugging time is much higher.

Are there, instead, good coding practices that all developers can follow, so they can avoid the negatives of using SASS and get some of the benefits of using standardized CSS?

(I am not sure if the MVC site will use the Razor View Engine, but does this change your opinion of using SASS?)

Thanks
0
What .NET Technologies in a New MVC Application?

If you needed to architect a new  .NET MVC Application today, what would it consist of?

What version of .NET, MVC, might it be?
And what about Dependency Inversion?
What about Unit Testing?
What is your preferred Unit Test Framework?
What about AutoMapper?
How about a MOQ tool?

And what else am I forgetting to mention?

Thanks
0
Is KPM the String-searching algorithm needed to give user a City Name search field?

I need to code a CityName input field which allows the user to type a few characters, then show the user the closest matches, in a list.

Can you break this out into what is generally needed for this algorithm to work? Is KPM a choice?

As you can see, I just need to get my arms around this, conceptually.

 I would appreciate any guidance you can provide me.

Thanks
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.