Improve company productivity with a Business Account.Sign Up


ASP.NETSponsored by Flatiron School





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

Hey all I am using the following code on my local machine to give me a temporary WCF service:
    using System;
    using System.Windows.Forms;
    using System.ServiceModel;
    using TestService;
    namespace TestClient
        public partial class Form1 : Form
            IService1 patientSvc = null;
            public Form1()
            private void Form1_Load(object sender, EventArgs e)
                EndpointAddress address = new EndpointAddress(new Uri("net.tcp://localhost:2202/PatientService"));
                NetTcpBinding binding = new NetTcpBinding();
                ChannelFactory<IService1> factory = new ChannelFactory<IService1>(binding, address);
                patientSvc = factory.CreateChannel();

Open in new window

And the class1:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.ServiceModel;
    using System.Runtime.Serialization;
    namespace TestService
        public interface IService1
            Patient GetPatient(Int32 index);
            void SetPatient(Int32 index, Patient patient);
        [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
        public class PatientService : IService1

Open in new window

Free Tool: SSL Checker
LVL 12
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


I have a usercontrol with the name WorkflowDotList.ascx. In that usercontrol I have a public property with the name CarID.

Now I have placed the usercontrol inside of a grid template column like this:

<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center">
                        <uc1:WorkFlowDotsList runat="server" ID="WorkFlowDotsList"  />

Open in new window

Now I need to get hold of the public property of the usercontrol in the Itemdatabound event of the grid, so I can assign the carID for that particular item row.

How can I get hold of the carID property of the usercontrol and assign av value to it in the itemdatabound event?

Thanks for help!

Hi Experts,

I have a button on my form. When I click it, it supposed to popup a modal form. My problem is it pops up the modal form sometime but not all the time. I am using and c#. Any reason why it is happening. I have attached the code. When "#btnArchive" is clicked, it should popup the window all the time.

Thanks in advance.
How to dynamically call a single product  from multiple products having same database schema using mvc. Does entity framework support it.
dear all

i am using the below code :
<script type="text/javascript">
TrackingParams = new Array(142);
TimeParams = new Array(0);
CustomerParams = new Array(0);
 for (i = 0; i < TrackingParams.length; ++i)
 TrackingParams[i] = new Array(3); 
 TrackingParams[0][0] = '33.9790257';
 TrackingParams[0][1] = '35.6247374';
 TrackingParams[0][2] = '08:46';
 TrackingParams[1][0] = '33.9789747';
 TrackingParams[1][1] = '35.6247476';
 TrackingParams[1][2] = '08:49';
 TrackingParams[2][0] = '33.9792066666667';
 TrackingParams[2][1] = '35.624365';
 TrackingParams[2][2] = '09:01';
 TrackingParams[3][0] = '33.9794366666667';
 TrackingParams[3][1] = '35.6241216666667';
 TrackingParams[3][2] = '09:02';
 TrackingParams[4][0] = '33.9794066666667';
 TrackingParams[4][1] = '35.6231183333333';
 TrackingParams[4][2] = '09:02';
 TrackingParams[5][0] = '33.9793733333333';
 TrackingParams[5][1] = '35.6211966666667';
 TrackingParams[5][2] = '09:03';
 TrackingParams[6][0] = '33.979195';
 TrackingParams[6][1] = '35.6205316666667';
 TrackingParams[6][2] = '09:03';
 TrackingParams[7][0] = '33.9791083333333';
 TrackingParams[7][1] = '35.6201683333333';
 TrackingParams[7][2] = '09:03';
 TrackingParams[8][0] = '33.9785';
 TrackingParams[8][1] = '35.61915';
 TrackingParams[8][2] = '09:03';
 TrackingParams[9][0] = '33.9777';
 TrackingParams[9][1] = '35.6178283333333';
 TrackingParams[9][2] = '09:04';
 TrackingParams[10][0] = '33.9766133333333';
 TrackingParams[10][1] = '35.61607';

Open in new window

I have a javascript function to expand the grid rows when an image is clicked.

 <script type="text/javascript">
        $("[src*=plus]").live("click", function () {
        $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
        $(this).attr("src", "images/minus.png");
    $("[src*=minus]").live("click", function () {
        $(this).attr("src", "images/plus.png");

Open in new window

I need to call this function from code  behind in order to expand the row dynamically. How can I achieve this??
I've implemented a custom PersistedGrantStore storing my refresh tokens in a xml file, however I now have problems refreshing my tokens.

When I remove following lines, the refresh works

services.AddTransient<IPersistedGrantService, PersistedGrantService>();
services.AddTransient<IPersistedGrantStore, PersistedGrantStore>();

Open in new window

When I put those lines back, I get the following in the logs :

2018-04-24 14:14:51.094 +02:00 [DBG] [IdentityServer4.Hosting.EndpointRouter] Endpoint enabled: Token, successfully created handler: IdentityServer4.Endpoints.TokenEndpoint
2018-04-24 14:14:51.095 +02:00 [INF] [IdentityServer4.Hosting.IdentityServerMiddleware] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.TokenEndpoint for /connect/token
2018-04-24 14:14:51.098 +02:00 [VRB] [IdentityServer4.Endpoints.TokenEndpoint] Processing token request.
2018-04-24 14:14:51.108 +02:00 [DBG] [IdentityServer4.Endpoints.TokenEndpoint] Start token request.
2018-04-24 14:14:51.115 +02:00 [DBG] [IdentityServer4.Validation.ClientSecretValidator] Start client validation
2018-04-24 14:14:51.120 +02:00 [DBG] [IdentityServer4.Validation.BasicAuthenticationSecretParser] Start parsing Basic Authentication secret
2018-04-24 14:14:51.123 +02:00 [DBG] [IdentityServer4.Validation.PostBodySecretParser] Start parsing for secret in post body
2018-04-24 14:14:51.145 +02:00 [DBG] [IdentityServer4.Validation.SecretParser] Parser found secret: PostBodySecretParser
Greeting again mates,

I have a fieldname called salesPrice with data type of Money.

On the markup, the fieldname is called txtsalePrice.

On my markup, the value shows 125.000

When I formatted txtsalePrice to currency with two decimal places, using the following code:

<asp:TextBox ID="txtsalePrice" Text='<%# Eval("salePrice","{0:###,###,###0.#0}") %>' runat="server" placeholder="Enter Taxpayer returned value as of Jan. 1..." Style="width: 400px;" class="form-control txtPayerret"></asp:TextBox>

Open in new window

Now, it formats correctly to $125.00.

This looks good now. However, if the value of the field is 0, I get the following error:
Input string was not in a correct format.

This error is on this line:
dr["salePrice"] = ((TextBox)Repeater2.Items[rowIndex].FindControl("txtsalePrice")).Text;

Open in new window

Any idea how to resolve this problem?

I am using Repeater control.

Thanks in advance
What is the best membership service, API or membership database to use for authentication with Web API, SQL SERVER and/or with C#?  Thank you!
Hi I am creating dynamic textbox with textchange event, When i change text then textchange is calling fine but when I hit on button then before button click that textchange event is called, I am not sure why it is calling. Please help
Free Tool: Path Explorer
LVL 12
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

I have an MVC application in EF Core that I tried using the @media print etc. and using this in chrome but the print always is showing my layout page etc.   How can I handle this best without having to build all new pages etc. to have a print button in EF Core MVC that would ignore the layout?  I tried multiple things found on forums with no luck.

What are the steps to migrate an app using .net framework 4.0 to 4.5 using Visual Studio 2017?
what web server language for this code:

<!DOCTYPE html>
     <h1>Hello Web Pages</h1>
     <p>The time is @DateTime.Now</p>

I have a windows server that supports asp and but it's don't provide the date time. I try to change the file extension to asp or aspx but the problem stays.

thnaks a lot
I need to develop a good/correct strategy in ASP.Net to read from 4 cascading data/api feeds using VB, and display them all in a single page.

The first feed contains a list of clients and their id numbers, the second feed contains a list of client locations and their id numbers, the third feed contains a list of assets/equipment, and the fourth feed contains additional info about the equipment. Each feed except for the first requires an id number, so if a client has 4 locations, then the locations feed has to be queried for each location id and so forth.

The URLs are pretty predictable, as are the XML responses. The URLs looks like this:

And for each asset found:

I've played around with repeaters and xmldatasources with success, but once you try nesting them 4 layers deep, things get messy.

My need is to report on the 4th level data, flagging and displaying items which are in need of attention so that the appropriate people can act on them.

Some things I've considered:
* Caching XML results to file …
hi everyone i am doing a website using and i want to display my access database table content in a formview but the problem is this, i am using a master page and div tags, i devide my form in 3 div tags, the side bar, and menu then main content div, i floated my content div to the right but now i cant see my formview on the content div
How do I make this an async action result if I am using auto mapper.

        public async Task<IActionResult> Index()
            var items = _context.Customers.ToListAsync();
            var mappedItems = _mapper.Map<List<CustomerViewModel>>(items);

            return View(mappedItems);

The issue is from the context I can use ToListAsync but I can't use the await such as return View(await mappedItems);.   What is the best way to handle this when using automapper?
I want to display rows in ascending order in grid view after clicking on button. here is the code. code has no error but not displaying rows in ascending order.

protected void Button2_Click(object sender, EventArgs e)
            DataTable dt = new DataTable();
            string str = "select id,dte from test order by id asc";
            oda = new OracleDataAdapter(str, Dbconn);


        catch (Exception ex)

What authentication setup do I need when publishing to IIS a identity provider web application?   I have all the aspnet user tables in SQL server etc and when I run in debug mode I can login as the user I setup.   However, when I publish to IIS I am getting errors.   Do I need a anonymous and windows authentication and also what identity should the app pool run under?  Eventually I am going to create a service account that I can run under but for now just want to use my windows auth.
I'm working on a side project... it's forms with names, address, and other info. One of the fields is SSN.

I plan to encrypt the name and address fields. I can encrypt SSN as well but with all the cyber security issues going on... I'm thinking I shouldn't even store SSN or only store the last 4 digits.

The application will be hosted on a hosting server (ARMOR) eventually.

Any thoughts on if I should store SSN and encrypt or just leave out SSN? users can always search by name.
Free Tool: Port Scanner
LVL 12
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I am working on an existing ASP.Net MVC application, which has a partial view that is called on numerous occasions in several views across the site.  So, in a single instance the partial view an be called up to five times giving me 5 uniquely named objects on a full page when it is loaded. At the moment, the Javascript that is being used is held within the partial view, however we have a requirement to separate the Javascript into its own file so that the View and the JS do not exist in the same space.

The reason for the seperation is that the application that is being worked on is now part of a unification project where a WinForms application is going to be 'Migrated' into ASP.MVC.  The two applications share a number of features, hence the unification, and the desire to split the View and the JS.

In one instance on the page we have

 @if (!Model.CustomChangeScripts)
        var onSelectFn = "function " + Model.sName + "_onSelect(e)";
        onSelectFn += "{ var dataItem = this.dataItem(e.item.index()); ";
        onSelectFn += "window.document.getElementById('" + spnSummary + "').innerHTML = dataItem.Summary;";
        onSelectFn += "window.document.getElementsByName('" + Model.NameOfIdField + "')[0].value = dataItem.Id;}";

        var onChangeFn = "function " + Model.sName + "_onChange()";
        onChangeFn += "{ if ($.trim(window.document.getElementsByName('" + Model.Name + "')[0].value) == '') {";
        onChangeFn += 

Open in new window

This code works. I've used LINQ to SQL on some projects but now wondering if there's a better way of coding this. I'm using stored procs and I want to see if I can use parameters for the stored proc. I don't want to use Entity Framework

1. I have a DBML
2. I have a stored proc
3. I have a model

4. I call the stored proc like this


  private LPDataContext _dbContext;
        public FormsRepository()
            _dbContext = new LPDataContext();

_dbContext.usp_InsertPersonali765Draft(model.ApplyReasonId, firstName, model.MiddleName,
                    otherFirstName1, model.OtherMiddleName1, otherFamilyName1, otherFirstName2,
                    model.OtherMiddleName2,otherFamilyName2, otherFirstName3, model.OtherMiddleName3, otherFamilyName3,
                    streetAddress, model.AptNumber, city, model.StateId, model.ZipCode,
                    model.BirthCity, model.BirthState,int.Parse(model.CountryOfBirth), dateOfBirth, model.Gender,
                    model.MaritalStatusCode, model.UserName);

Open in new window

Is this code ok? should I leave it as is?  

How can I call the stored proc with parameters? This is an example of Linq to SQL insert but it doesn't use a stored proc Example

Another one here but it's not a stored proc Another example

EDIT: I'm concerened about SQL Injection but maybe how I have it is correct. See here Example 3 It says
Linq to SQL turns the curly braces into a parameterized query.
Using Visual Studio 2015 and Team Explorer, I've encountered an error while fetching from the GIT repository.

Error encountered while fetching: The given reference name 'refs/heads/master (DESKTOP-96E21S3's conflicted copy 2018-04-16)' is not valid

My solution is stored in my DropBox account. I have googled this error and it only brings up dropbox solutions, but I'm thinking this error is related to Team Explorer since it occurs when fetching.


I cannot delete it, merge it, or reset it. I can't check out code or check in code.

Any ideas how to fix this?

I'll go step by step. I wonder why blank gets inserted instead of null

1. This is in the model
public string MiddleName { get; set; }

Open in new window

2. Database column is this
[MiddleName] [varchar](250) NULL,

Open in new window

3. I don't enter anything in  the middle name field
4.  I have this line of code

 var middleName = string.IsNullOrEmpty(model.MiddleName) ? (object) DBNull.Value : model.MiddleName;

Open in new window

5. I see the value is null
null value
6. I see this after the line of code is executed
value of middle name
7. I call a stored proc and insert it like this. I out .ToString() because I was getting an error that Object can't be converted to string

  _dbContext.usp_InsertPersonali765Draft(model.ApplyReasonId, firstName, middleName.ToString(),

Open in new window

8.  This is part of the stored proc

ALTER procedure [dbo].[usp_InsertPersonali765Draft]

@ApplyReasonId int,
@FirstName varbinary(max),
@MiddleName varchar(50),

Open in new window

9. I see blank . I want to save Null

I have a page which contains a TreeView control. Each of the TreeNodes has it's ShowCheckBox attribute set to True.

Under the TreeView is a button which carries out actions, based on the nodes that are ticked in the TreeView, this works fine.

What I would like to do is define another action (independent of the ticked/unticked state) which fires whenever the text of the node is clicked.

Is there a way to do this?

ASP.NETSponsored by Flatiron School





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