The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

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

Sign up to Post

What top .NET Technologies for .NET Technical Lead Role?

I am brushing up on various .NET Technologies to fill a  .NET Technical Lead Role which will involve not only various technology choices, but mainly the communication with a global team of developers who need to implement these technologies.

So, please provide me a list of .NET Technologies which I should prioritize as I spend the next few weeks ramping up.

I may also be looked at to assemble a list of coding standards (coding do's and don't's), then to use code reviews, pull requests, etc. to help communicate those coding standards to a team, some of which may be an offshore and on a different timezone.

So, can you start with a short list of .NET technologies that can prime the pump and get my juices flowing again with these topics, most (or all) I have worked with previously in some capacity.

I've been ask this question in two different interviews...

What is the benefit of using stored proc ? another guy asked... when would you use a stored proc over inline sql

My answer:
Stored proc makes an application database agnostic ... application layer is separate from the data
Stored procs are compiled

When do we want to use a SP over inline SQL?  I didn't answer this one.

No matter how much I prepare for an interview... there's always something unexpected thrown at me!
I've been reading about anonymous types and I think the answer to this question is the 4th one "new class with properties both set and get methods". Saw an explanation on a site but forgot to bookmark it

I am getting an error as below when i deploy the code in IIS where as in local it works fine.

I have a master page and master page has an update panel which display a popup on click of a button . Inside an update panel it has two buttons which on click is performing operations server as well as client side operations. It has a child page where <asp:ScriptManager>.. has been employed (i.e., AJax CDN toolkit ). Now the issue seems to be like whenever the child page is loading it is not allowing a postback from master page's Update panel , whereby giving an exception as below :

Uncaught TypeError: Cannot read property 'PRM_ServerError' of undefined
    at Sys.WebForms.PageRequestManager._createPageRequestManagerServerError (MicrosoftAjaxWebForms.js:6)
    at Sys.WebForms.PageRequestManager._parseDelta (MicrosoftAjaxWebForms.js:6)
    at Sys.WebForms.PageRequestManager._onFormSubmitCompleted (MicrosoftAjaxWebForms.js:6)
    at Array.<anonymous> (MicrosoftAjax.js:6)
    at MicrosoftAjax.js:6
    at Sys.Net.WebRequest.completed (MicrosoftAjax.js:6)
    at XMLHttpRequest._onReadyStateChange (MicrosoftAjax.js:6) 

Open in new window

i tried setting like this to supress it, but it did not help :
<script runat=server>
  $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest( endRequest );

        function endRequest( sender, e ) {
            if( e.get_error() ){
                document.getElementById("error").innerText =  e.get_error().description;
                e.set_errorHandled( true );

Open in new window

the issue is driving me nuts ! and i need a proper solution to make the button click in updatepanel work in Master page .
Practicing interview questions. Why does the second line throws an error? Is it because an explicit conversation is needed? I read about ValueTypes but still don't understand why it errors out..

IEnumerable<object> objects = new List<string>();
IEnumerable<ValueType> v =  objects; //*** error here.
I'm reviewing some interview questions. Why is the first one wrong and the second one correct?

            IEnumerable<string> objects1 = new List<object>(); //*** not correct

            IEnumerable<object> objects = new List<string>(); //correct
I had an interview the other day and they let me keep the test. I'm reviewing it to learn more...

One of the questions is: difference between  declaring an argument as "dynamic" vs "object". I answered #2 below. I've been reading about it and I think it's correct because of boxing and unboxing --> dynamic doesn't need it but Object can be cast. Is this correct?

I have a text box that I want to fill in code behind with an sqldatasource defined in client side.  How to I use this data source in code behind to fill one data point in the text box.  Below is my code.

Thanks in advance for the help.

<asp:SqlDataSource ID="Die_PtDscDataSource11" runat="server" ConnectionString="<%$ ConnectionStrings:...ions %>"
                                                    ProviderName="<%$ ConnectionStrings:ASTJV...finitions.ProviderName %>"
                                                    SelectCommand="SELECT DieNumber, PartDescription FROM METRICS WHERE Department=@Department AND PartNumber=@PartNumber">
                                                        <asp:ControlParameter ControlID="DeptDrpDn11" Type="String" />
                                                        <asp:ControlParameter ControlID="PrtNoDrpDn11" Type="String" />
I have a website and try to track client IP to locate his/her for better information tracking.
we use c#/mvc/razor.

any suggestions on what we can use?

Need a quick start in SiteCore

I have a new job as a .NET Software Engineer and expect to need to integrate .NET Framework code and ASP.NET code with SiteCore. So, I want to be a quick study with SiteCore, since I have not yet worked with that CRM.

Can you provide me URL's to some key videos and/or documents where I can start the process of getting acclimated?

I'm practicing some online code examples for my potential interviews and I came across one code sample --> pass in 2 integers and bring back odd numbers between the range, inclusive.

Why is this bringing back 11? it shouldn't

Or, if I pass 96 and 97

List<int> list = new List<int>();

			int l = 3;
			int r = 9;

			List<int> t = Enumerable.Range(l, r).ToList();
			var oddNumbers = t.Where(num => num % 2 != 0);

			foreach (int i in oddNumbers)

			var res = list;

Open in new window


I have an template field that holds a DateTime value
I use the following line to find the control. How do I just get the date part in the format "dd MMM yyyy"?

      Dim lblDateTime As Label = CType(row.FindControl("lblDateTime"), Label)
I have a simple website, with a default page and on page_load function , I check some basic user information by calling a web service, getting a response and checking whether or not a certain value exists in the response for every user. I don't fully understand page cycle and post back in website.
My current code looks like following sample.

I am not sure , when this IsPostback returns true or false. My assumption is that my code to call the web service only fires when the page loads , after that i don't have to call it again for the same user. does the following code construct accomplishes that . if not what can i do to achieve that.

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
               if (! IsPostback )  {
                   //call web service 
                    if ( response != null && hasSomeValue) {
                        //user is authenticated and has full access to the site 


Open in new window

I am trying to center the results of my ASP.Net ListView control with the rest of the items that are perfectly centered on the page. I've tried different settings but nothing seems to work. I do not want to go back to a gridview control. If I can get the listview centered it would be perfect. Here is my code below.

<asp:ListView ID="ListView1" runat="server" DataKeyNames="eid" DataSourceID="SqlDataSource2">
                       <table runat="server" style="">
                               <td>No data was returned.</td>
                       <tr style="">
                               <asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
                               <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                          <%-- <td>
                               <asp:Label ID="bodypartmgLabel" runat="server" Text='<%# Eval("bodypartmg") %>' />
I have an iframe in Masterpage updatepanel . It has an .html page as its source. So, there is a textarea where the html page is displayed .  When i modify the html page in the textarea and click on a button , it should update the html content back to html page. [Basically i want the updated dom of the iframe to be assigned back to the innertext of the html body of the html page . i am currently using htmlagility pack to achieve read and save of the .html page. The only thing not working is the updating of .html file dynamically .

Is it possible to do so ?
I have object call Lead and a static method just like email template.
insid of using statement. is it possible to loop the Lead object and get the list of child object?
like this:

body = body.Replace("{displayname}", l.childname);

I have very long list and do not want to type line one by one.


public static string CreateEmailBody(Domain.Lead l, string templatePath)
            string body = string.Empty;
            using (StreamReader reader = new StreamReader(System.Web.Hosting.HostingEnvironment.MapPath(templatePath)))
                body = reader.ReadToEnd();
            body = body.Replace("{FirstName}", l.FirstName);
            return body;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain
    public class Lead
        public int LeadID { get; set; }
        public string Subject { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Email { get; set; }
        public string MobilePhoneNo { get; set; }
        public string LeadStage { get; set; }

Open in new window

I am trying to post form field data from a page. The form filed is an textbox control. I am trying to do the following:

1. Enter a value in the form.
2. Click the submit button.
3. Return the results in a Gridview control or even a Detail view.

This is a simple webform page. I am doing this in I am trying to avoid doing this programmatically in the Code Behind page and I know it can be done but I am missing something. I created the SQLDataSource and when I test it there it brings back results. I can even pass a url string value and get results. I believe I have forgotten how to do this with form field values. Do I need to place something in the code behind? It seems I am missing something simple. Here is my code below:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="2posted.aspx.vb" Inherits="_2posted" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
                       <asp:TextBox ID="search" runat="server"></asp:TextBox>    

                    <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="~/2posted.aspx" />  

           <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
I have the following string sent from a web page

I need to adjust each value and divide by half

i.e.  this result
[[10, 10], [20,20]]

Needs to become
[[5, 5], [10,10]]

What can i acheive this in c#??

here is data set:

Open in new window

I'm using visual basic .net in a aspx web forms application

If I have a string variable that looks like this that contains numbers and characters.

How do I save only the numbers in a different variable called Intvariable1 ?

Testvariable1 = "123|YYY"

sometimes the values in TestVariable1 will be this "123|YYY"  or this "12|YYY"  or this "3|YYY"
Compare a List with an Array (in .NET)

Please list the pros and cons of each.


I want to use Rich textbox of Windows Forms Control Library User control  into an ASP.NET web forms application . Can you please let me know how to do that ?
Not sure why it always return 0 on last two decimal. like 4.00 5.00... I hope to see 4.23 e.g.

                                decimal totalRate=0;
                                foreach (Domain.Review fReviewItem in rv.ReviewSummary(f))
                                    totalRate = decimal.Parse(string.Format("{0:F2}",(fReviewItem.TotalRateCount / fReviewItem.TotalReviewCount))); 

Open in new window

I got the third one wrong . I have my explanation in the code.

protected void Page_Load(object sender, EventArgs e)
			string weather = "rainy";
			var p = weather; //*** this comes out as "rainy" because string is a reference type so even tho the function changes the value, we'll still get "rainy"

			string[] rainydays = new[] {"Monday", "Friday"};
			var t = rainydays; //*** this comes out as "Monday" and "Sunday". string array is a value type? (I don't think this is correct even tho I got the answer right)

			Forecast forecast = new Forecast {Temp = 700, Pressure = 20};
			var s = forecast.Temp; //*** this is 35. I got this wrong. I a new instance of Forecast is created and passed. If "class" is a reference type, why didn't I get 700?

		public class Forecast
			public int Temp { get; set; }
			public int Pressure { get; set; }

		public static void ChangeTheString(string weather)
			weather = "sunny";


		public static void ChangeTheArray(string[] rainyDays)
			rainyDays[1] = "Sunday";


		public static void ChangeTheClassInstance(Forecast forecast)
			forecast.Temp = 35;


Open in new window

I'm going over some sample code for my interview on Friday... code practices I'm finding.

This is the sample code. I run it and I get errors on 2 lines but I'm not quite sure about the explanation. I'll add my comments in the code below as to why I think the error occurs.

protected void Page_Load(object sender, EventArgs e)
			object car = new Car {MaxSpeed = 180};
			object processor = new Processor { MaxSpeed = 2500 };

			Vehicle v1 = (Vehicle) car;
			int speed = v1.MaxSpeed;

			Vehicle v2 = car as Vehicle;
			int s2 = v2.MaxSpeed;

			Vehicle v3 = (Vehicle)processor; //** error here with invalid cast. Why can't I cast processor to vehicle...because processor is not inheritng from Vehicle?
			int s3 = v3.MaxSpeed;

			Vehicle v4 = processor as Vehicle; //*** this comes out as null. I think because inheritance is "is a" relationship but processor is not a vehicle. Is this correct?
			int s4 = v4.MaxSpeed; //*** null error here because v4 is null

		public class Vehicle
			public int MaxSpeed { get; set; }

		public class Car :Vehicle{}

		public class Processor
			public int MaxSpeed { get; set; }

Open in new window

I am using the AjaxFileUpload part of the AjaxControlToolkit.  I am trying to trigger a javascript function from the OnClientUploadComplete function.  I put in the name of the function in quotes next to the OnClientUploadComplete= inside the tag and all looks fine.  When I run it in IE 11 I get an error the the function is undefined and AjaxFileUpload model and a grid below it do not finish loading on the page.  Only in IE 11.  What am I doing wrong.  If I take this out, the file uploads fine but the grid below show all files uploaded does not reload with the new file showing.  Reloading the page shows the new file.  I tried putting "javascript: functionName" inside the quotes and it causes other Javascript below that to malfunction and show a panel I was hiding until I click a link to show it.  Very strange and frustrating.  This is a web forms site that use to run in VS 2010 and now running from VS 2017.  Had other issues but need this one corrected first.

See the area of code below.  Commented out the Update Panel as a stab but no luck.

    <script type="text/javascript">
        function OnFileUploadComplete(sender, args) {
            //if (sender._filesInQueue[sender._filesInQueue.length - 1]._isUploaded)
            __doPostBack('updatePanelAttachments', '');    // Do post back only after all files have been uploaded

        function padDatePart(part) {
            return ('0' + part).slice(-2);

        function OnlblStepErrChanged() {

Open in new window







The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications