ASP.NET

125K

Solutions

28K

Contributors

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

Hi Expert,
Can you help me to find out where i'm doing mistake or how to call this and also I used  newtonsoft

Following way i have tried to Deserialize Json. The results from REST services working fine
(candidateResults) i iwll get the data.

 var jcCandidate1 = JsonConvert.DeserializeObject<List<candidateDetails>>(candidateResults);

also i tried
 var jcCandidate1 = JsonConvert.DeserializeObject<List<candidateDetails>>(candidateResults);

Open in new window



all classes  created according to Json Results. (go to Edit special paste -> select Json)

namespace TestConsolApp
{
   
    public class candidateMain
    {
        public candidateDetails[] Property1 { get; set; }
    }

    public class candidateDetails
    {
        public string _id { get; set; }
        public DateTime creation_date { get; set; }
        public string email_address { get; set; }
        public string headline { get; set; }
        public string initial { get; set; }
        public string name { get; set; }
        public string origin { get; set; }
        public string phone_number { get; set; }
        public candidateResume resume { get; set; }
        public candidateSource source { get; set; }
        public candidateStage stage { get; set; }
        //public object[] tags { get; set; }
        public DateTime updated_date { get; set; }
    }

    public class candidateResume
    {
        public string url { get; set; }
    }

    public class candidateSource
    {
        public

Open in new window

0
Become a Microsoft Certified Solutions Expert
LVL 13
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

I can get Date variable to match sql server date to use in code to find indexed line in database table.  I have tried multiple formatting options - nothing works.  I need to include miliseconds in the vb.net Date format - not in string format.  I use this in a <= operations to compare date to the database.  When it is = it uses that indexed line to include in the charted data.  Everything I have tried gives me date and time without miliseconds.

I have tried the following.

Dim MaxDate As Date = DataTable.Rows(0)(0)
MaxDate = Date.ParseExact(DataTable.Rows(0)(0), "yyyy-MM-ddTHH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture)

I can convert using a string variable, but cannot use string variable in query search for date.
0
Hi Experts,

I have write following code. This code is working fine and geting results.
But only issue is how to return type designing.

 public async Task<List<Positions>> positionDetails(bool onlyCurrent = true)
        {
var results=response.Content;
var pJson = JsonConvert.DeserializeObject<List<Positions>>(results);

retrun ???

}

Open in new window


Any idea really appriciated
0
Hello Experts!

I am working on asp.net application in asp.net technology the application is very old around 10 years back.
I am using this configuration in web.config:

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="UseCookies" timeout="20" cookieName ="DrainId"/>

As we know that Session hijacking means if someone steal/copy session cookie and paste it another browser then the one can access any inner page of the web application.
how can we stop the session hijacking so that if session cookie is pasted in another browser we can redirect such request to the login page.

 I copied this way the cookie so that I can paste in another browser and open inner page.
0
Hi,

How can I make a sub menu using my table menu?

I need a sub menu to Blended or Inpatient or Outpatient.
They each have a submenu. How can I do that?
This is my left menu.

I want on hover over the word "Blended" to list a submenu

 <table class="table">
                                                <tr>
                                                    <td>
                                                        <a id="RuleMenuDiv" href="../Rule" style="color:#0144af;">Rule</a>
                                                        </td>
                                                </tr>
                                                <tr id="BlendedMenu"> 
                                                    <td style="background-color:#5cb85c; color:#fff;font-weight:bold;">
                                                        Blended
                                                    </td>
                                                </tr>
                                                <tr id="InpatientMenu">
                                                    <td style="background-color:#5cb85c; color:#fff;font-weight:bold;">
                                                        Inpatient
                                                    </td>
                                                </tr>
                                                <tr id="OutpatientMenu">
                                                    <td 

Open in new window

0
I have these tables I want to return ONE row per employee.

Employee
EmployeeId
EmployeeName

UnitJobEmployee
EmployeeId
UnitId
JobId

Unit
UnitId
UnitName

Job
JobId
JobName


The problem is that an employee can have multiple unit/job rows.

So after we get the employee row, currently we look up the unit/job rows and return them as comma delimited strings. One for units, one for jobs.

I'd like to see if it is possible to return that in the original select statement, rather than doing it after the fact when looping through the collection.

So the result would look more like this:

EmployeeId, EmployeeName, UnitsString, JobsString
57                   Joe                        XYZ,               Cashier,
                                                     ABC               Stocker

Any ideas?

Thanks!
0
I have written a page that posts data for a client into the above, It works as part of a new website as the only page (used for testing) when I copy the code or paste the page into the web application I have been developing it for I get an error, I've used Nuget to ensure all the correct dll's are added.

This is the error

"An existing connection was forcibly closed by the remote host
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host"

This line is causing the error:
Dim myresponse As HttpResponseMessage = client.SendAsync(myrequest).Result


Can anyone suggest a solution or reason why the same code fails in one web application but not the other?

Here is the code

Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Threading.Tasks
Imports Microsoft.IdentityModel.Clients.ActiveDirectory
Imports Newtonsoft.Json.Linq
Imports System.Collections.Generic
Public Class CRM_Contact
    Inherits System.Web.UI.Page

    Public myclientId As String = Convert.ToString(ConfigurationManager.AppSettings("clientid"))
    Public redirectUrl As String = Convert.ToString(ConfigurationManager.AppSettings("redirecturl"))
    Public serviceUrl As String = …
0
I have a larger site on IIS and now I am planning to add an asp.net web application to one of its folders, like this:

FLD_ROOT
    FLD_TXT
    FLD_APP

where FLD_ROOT is the root of the larger site and FLD_APP is the folder where I plan to deploy the application. In addition, the site contains the FLD_TXT folder.

The application needs to read the text files in FLD_TXT when it starts. It is not possible to include those files with the application (for site maintenance reasons).

My question is, can my application access those files? They are not part of it, but still part of the site. If not, what would be a solution to grant access?
0
I need a multiple selection drop down list that looks similar to this.

I currently use Telerik's but we are doing away with using Telerik.

Does anyone know of another jquery/javascript type of solution that does something like this?

We've been using Select2 for our comboboxes, but it doesn't support this kind of look.
ddl
0
How do I fix a localhost:#### port in use error?  I have several ASP.Net Web Applications.  All load fine in Microsoft Visual Studio 2019; however, two of them present the error and fails to run.

How do I fix this???
0
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'm using a select2 multiple dropdownlist. I am getting the above error.
I've seen posts where they say this error occurs if you have two items in the list with the same value, but I do not have that and I also use the "multiple" option.

    <select name = "ctl00$ContentBody$TeamProfileControl$ddlDistrictId" id="ddlDistrictId" Class="ddlSelectMultiple" name="ddlDistrictId" multiple="multiple" style="width:100%;">
    	<option value = "1786" > AP_Test_District</Option>
    	<option value = "209" > Honey Dew South</Option>
    	<option value = "562" > HQ</Option>
    	<option value = "38" > JK&#39;s Crib</Option>
    	<option value = "206" > Kansas City Office</Option>
    	<option value = "759" > Testing District</Option>

    </select>

Open in new window


I also read to add items this way, however, I populate with a sql databind, so using this is not applicable:
DDLModality.Items.Add(Li1)

I need to preselect the previously saved values in the dropdownlist to display them as selected on the screen. Here is my code, it runs with no errors but when the screen is loaded it generates:
Cannot have multiple items selected in a DropDownList.

   Public Sub CheckMultiListBoxNumeric(ByRef ddlDistrictId As DropDownList, ByVal districtIds As String)

        ddlDistrictId.ClearSelection()

        Dim checkedItems As String()
        checkedItems = Split(districtIds, ",")
        Dim selected As List(Of String) = checkedItems.ToList()

        For Each row As String In selected


            If ddlDistrictId.Items.FindByValue(row) IsNot Nothing Then
                ddlDistrictId.Items.FindByValue(row).Selected = True
            End If


        Next

Open in new window

0
Hi I am new to C# core and I come from a VB forms background.  I have been working on a web application project using the latest asp core.  

All i am trying to do at the moment is have a page where you enter a serial number then on leaving that serial number it comes back and displays some additional information from a stored procedure in a grid on the page or it displays an error from the stored procedure.  Then there is another button that will fire another stored procedure that will insert data into a database or return an error on error checks.   If not an error the whole page resets and ready for the next one.

The problem I have been having is that i cannot work out how to fire the stored procedure and return the data after leaving the text box and display an error if needed.  To simply it I have added a button so I enter the serial number then press the button rather than get the on leave event from the text box.

My problem is the data is binded before the page loads with some default data.  I do not know how to do it part of the way through or how to pass a parameter (serial number to it).  I have the ajax to call a function that displays the data from before, but i do not know how to change the lookup to be based on that serial number.  Or in the case of being an error display an error.

My code is below:
Model class:
public class OperationsData
    {

       public string Job { get; set; }
       public string Item { get; set; }
       public 

Open in new window

0
How do you reset a Microsoft ASP.NET Application?  I have the following files:

*.master
global.asax
*.aspx
web.sitemap
*.aspx.vb
web.config

I want to use the files I have and start all over.  Is this doable?  If so,  how???
0
Need to get value of webpage URL (with query string parameters, without, and only string with parameters)
Thank you in advance.
0
In Visual Studio or asp.net is there a way to track a programmer's productivity -- lines of code created or altered and time spent in the project actively working/ debugging/ etc.?

We use Team Explorer for our code repository, so perhaps there is a way to use that.

I've looked at an example of a coding tracker and it seemed to only handle it locally for the local person to see. I'd like something perhaps handled in Team Explorer by the checked in developer.

I once worked for a company that had a tracker like that, but not visual studio related, and at the end of a quarter they would have a % productive and level of difficulty the person did in their coding.

Is there such a thing available anywhere for .NET programming?


thanks!
0
Hi,
Question: I wanted to host my web application developed in React.js and asp.net core 2.2 WebAPI with unlimited SQL Server 2012 (or higher) databases support. Which shared hosting plan best suites this requirement?
Please help
0
Issue: When I output a binary file that is being pulled from SQ server, no matter the different variations of the code below, I get this popup error from Microsoft Word.

I click ok, and the complete document DOES come up in Word. I tried with several other files and works every time. I need to get this popup to not come up.  (see attachment)
Issue-10-15-19.docx
0
Can you please tell me why this routine is not showing values in the text box when i click in the text area?
screenshot.JPG
      private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox i = sender as ListBox;
            if (i.SelectedIndex != -1)
            {
                listBox1.SelectedIndex = i.SelectedIndex;
                listBox2.SelectedIndex = i.SelectedIndex;
                txtID.Text = listBox1.SelectedItem.ToString();
                txtName.Text = listBox2.SelectedItem.ToString();               
            }
        
        }

Open in new window

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace InsertUpdateDel
{
    public partial class Form1 : Form
    {
        SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Lenovo\Documents\Visual Studio 2012\Projects\InsertUpdateDel\InsertUpdateDel\Database1.mdf;Integrated Security=True;User Instance=True");
        SqlCommand cmd = new SqlCommand();
        SqlDataReader sd;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
                cmd.Connection = cn;
                loadlist();
        }

        private void button1_Click(object sender, 

Open in new window

0
Can you please help me in that error?
screenshot.JPG
namespace InsertUpdateDel
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txtID = new System.Windows.Forms.TextBox();
            this.txtName = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.listBox2 = new System.Windows.Forms.ListBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            

Open in new window

0
CompTIA Cloud+
LVL 13
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Can you please help me in that error?
Error in List Box[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace InsertUpdateDel
{
    public partial class Form1 : Form
    {
        SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Lenovo\Documents\Visual Studio 2012\Projects\InsertUpdateDel\InsertUpdateDel\Database1.mdf;Integrated Security=True;User Instance=True");
        SqlCommand cmd = new SqlCommand();
        SqlDataReader sd;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
                cmd.Connection = cn;
                loadlist();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtID.Text != "" & txtName.Text != "")
            {
                cn.Open();
                cmd.CommandText = "Insert into info(id, name) values ('" +txtID.Text+"', '" +txtName.Text+"')";
                cmd.ExecuteNonQuery();
                cmd.Clone();
                MessageBox.Show("Record Inserted", "Programming");
                cn.Close();
                txtID.Text="";
                txtName.Text="";
                loadlist();
            }
        }
        …
0
Can you please tell me what this error means?

Error statement: sd = cmd.ExecuteReader();

screenshot.JPG
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace InsertUpdateDel
{
    public partial class Form1 : Form
    {
        SqlConnection cn = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Lenovo\Documents\Visual Studio 2012\Projects\InsertUpdateDel\InsertUpdateDel\Database1.mdf;Integrated Security=True;User Instance=True");
        SqlCommand cmd = new SqlCommand();
        SqlDataAdapter sd;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
                cmd.Connection = cn;
                loadlist();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtID.Text != "" & txtName.Text != "")
            {
                cn.Open();
                cmd.CommandText = "Insert into info(id, name) values ('" +txtID.Text+"', '" +txtName.Text+"')";
                cmd.ExecuteNonQuery();
                cmd.Clone();
                MessageBox.Show("Record Inserted", "Programming");
                cn.Close();
                txtID.Text="";
                txtName.Text="";
                loadlist();
            }
        }

Open in new window

0
I have a Asp.Net Core Application.

On one of my views I have an anchor tag like this this.

<a asp-controller="Speaker"
   asp-action="Index">All Speakers</a>

i have a CSS class that looks like this:

.LinkStyle1 a:link { color: #0000FF; }

Is there a way to add this class style to the asp-controller link tag?

One way that works is like this:

<span class=“LinkStyle1”><a asp-controller="Speaker"
   asp-action="Index">All Speakers</a></span>

Is there a better way to apply a css class to this asp-controller tag?
0
I have a ticketing system which is written in KnockOut using template. Template structure is as below This template is repeated for multiple users on a page. In this parent.AssignedTickets is a list of Ticket Id assigned to users. So system has multiple TicketIDs and if it is assigned to user then it shows checked.

I want to change label color if checkbox is checked.

<script type="text/html" id="TicketAssignmentTemplate">
    <td>
        <label>
          <input type="checkbox" data-bind="checkedValue: TicketId, checked: $parent.AssignedTickets" />
        </label>
    </td>
    <td>
        <label data-bind="text: title"></label>
    </td>
</script>
<style>.success{background-color: #DFF0D8;}</style>

Open in new window



I tried data binding label css: {success: !$parent.AssignedTickets} but that did not work. Surprise! It can't be that simple. Any other thing I can try?

Part 2. Reason, I want this label highlighted is because supervisors who assign Tickets know which Tickets are already assigned. So this Label color should be highlighted in other TicketTemplate of other users too. I think that will require having a list defined across multiple users and updating it real time as tickets get assigned.
0
I have a checkbox panel and I am adding the text for check box like this

chkPanel.Controls.Add(new CheckBox { Text = "Savings" + "This text needs to be red and bold", Checked = true, Enabled = false });
chkPanel.Controls.Add(new LiteralControl("<br />"));
chkPanel.Controls.Add(new CheckBox { Text = "Checking" , Checked = false, Enabled = false });


where you see "This text needs to be red and bold"  i actually want that text to be red and bold.  is it possible. if yes how?
0
My client wants a url like this:

http://mywebsite.com/NameofClient

I use ASP.NET WEBFORMS, so please no MVC answers.

If I do:

http://mywebsite.com/NameofClient

It expects that to be a folder name and errors.

If I do it with the ? it works:
http://mywebsite.com?NameofClient

But the client says ?'s are too confusing.

Any suggestions?

Can this be done with MapHttpRoute in the global.asax and then redirect to the page I want?
1

ASP.NET

125K

Solutions

28K

Contributors

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