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

I have written an API using asp.net core, which is hosted on Azure App Services. It is protected by Azure AD. I have written a javascript client using the MSAL library to consume the API, but i constantly get a 401 error.

I suspect there is a configuration problem in the api's registration or in the call from the client. Can anyone offer any help tracking the problem?
0
Greetings:

I am quite confused as to what I can do and what I cannot do within the UploadComplete event of the AjaxFileUpload control.

There are 2 ASPX Label controls which are assigned values within the UploadComplete event, however, the assigned values do not appear on the page after the event completes. The uploaded file is saved to the designated directory, however.

I'm including the ASPX, the VB code behind and the web.config files as follows:

ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title></title>
</head>
<body>
	<form id="form1" runat="server">
		<div>

			<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

			<asp:Label ID="Label1" runat="server"></asp:Label>

			<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server" AllowedFileTypes="jpeg,jpg,gif" />

			<asp:Label ID="Label2" runat="server"></asp:Label>

		</div>
	</form>
</body>
</html>

Open in new window

VB Code Behind
Imports AjaxControlToolkit

Partial Class _Default
	Inherits System.Web.UI.Page

	Private Sub AjaxFileUpload1_UploadComplete(sender As Object, e As AjaxFileUploadEventArgs) Handles AjaxFileUpload1.UploadComplete

		Label1.Text = "Here we are 1."

		AjaxFileUpload1.SaveAs("C:\inetpub\ClientWebs\AjaxFileUploadSync\Images\" & e.FileName)

		Label2.Text = "Here we are 2."

	End Sub

End Class

Open in new window

web.config
<?xml version="1.0" encoding="utf-8"?>

<configuration>

	<system.web>
		<compilation debug="true" targetFramework="4.0" />
	<pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages></system.web>

	<system.webServer>

		<handlers>

			<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />

		</handlers>

	</system.webServer>
</configuration>

Open in new window

Any assistance you might provide would be most helpful.


Much thanks,
David Bach
0
We have an app running on IIS 8.5 which are KPI dashboards running SQL queries and displaying the results in a browser. We have an issue where the dashboards in general begin to slow down and eventually become useless. We have tested the SQL queries used in the dashboards directly against Oracle and they run fine with no delay. The only fix so far we have found is to run IISRESET. Once we run IISRESET, it begins to work again. We also test the same queries within our ERP system(Oracle backend) which the dashboards feed off from different PC's and they run fine. The issue is with IIS or the app itself. if it was the SQL query being too heavy, you would see a slow response time when ran directly in Oracle. we have gone through and set IIS to vendor and Microsoft recommendations including using recycling.

Aside from defects in the code of the app, Is there anything we are missing in IIS that may be causing the issue?
0
Hi all,

We have an ASP.NET MVC application that has a partial page containing a select list, when the value of that select list is changed, we use JavaScript to populate a second select list.

After this happens we attempt to get the first value from the second select list, but there are no options for it. If we do a console.log output, we can see the second select list has it's new options, but the options.length property shows as zero. It is as if JavaScript sees it as a string of HTML and not an array of values.

Has anyone encountered this before and if so, how did you resolve the issue?

Thank you.

resourcesys.
0
We have a Asp.net core restAPI hosted on windows Azure.
Now we are looking cloud based logging service which we can use for the api hosted on azure.

If any service are there please let us know.
0
SharePoint Framework is client side.  ASP.net is server side.
Under what circumstances should I use webforms or MVC which are server based technologies and under what circumstances should I use SharePoint Framework which is client side?
How do they compare in terms of performance, security,  ease of use for developer, ease of use for enduser?
0
Hello. I am a newbie to programming. I'm working on a web form in asp.net. So my files are set up so that I have a Master page and aspx pages that look like this.
<%@ Page Title="" Language="VB" MasterPageFile="~/Layout.master" AutoEventWireup="false" CodeFile="delete.aspx.vb" Inherits="Appointment_Online_delete" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="wide" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>

Open in new window



   I have everything built.  But on the form I want a collapsible panel.  I've tried all the basic tricks I know and nothing works.  I have no problem doing this on a page with only 1 button but this page will have 2.  One button to submit the form and the other button to expand a content div or panel.  No matter what I've tried when I click the button to expand the panel or div it doesn't do anything but jump to the top of the page and trigger all my form validators.  It seems like it tries to submit the form also.   Like I said, I've tried several different way to do it but this is the way I would like to do it if I can get it to work.

Here is the panel
<asp:Panel id="pnlfaq_content" runat="server" Visible="false">

Open in new window

As you see I start off with the visibility of false because I want the user to click the button to see the FAQ information.

This is my button.  I've tried different types of buttons but I think a asp linkbutton is what I need. Let me know if there is something better.
<asp:LinkButton ID="btnFAQ" runat="server" onclick="btnFAQ_Click" CssClass="btn b_g" Style="width: 80px;"><span>FAQ</span></asp:LinkButton>

Open in new window


I was hoping it would be so simple as to just add this in my code file .aspx.vb
Protected Sub btnFAQ_Click(sender As Object, e As EventArgs) Handles btnFAQ.Click
        pnlfaq_content.Visible = True
    End Sub

Open in new window

But this doesn't work.  It only sends to focus to the top of the page and triggers my form validators as if I was submitting the form.  

I would like some help in how to make this work.   Thank you.
0
I have an ASP.NET MVC framework 4.5 with AngularJS that I’ve inherited and have to maintain.
The application had a .cshtml to PDF capability for a summary of all student questionnaires for a given term. The questions changed, and so we added a new .cshtml page for the new questions and renamed the .cshtml for the old questions.
Now there are
PrintSummary.cshtml
and
PrintSummaryBefore2019.cshtml.
What I’m trying to do is to have a condition somewhere in the code that will call PrintSummaryBefore2019.cshtml for queries before 2019 and call PrintSummary.cshtml for queries starting with 2019 and after.

The anchor tag for the Print To PDF functionality was originally coded like this:

   
<div style="padding-bottom: 10px; text-align: right;">
        <a class="btn btn-danger" href="../Survey/PrintSummaryPDF?Term={{term.Term}}&Campus={{campus.CampusId}}&Faculty={{faculty}}&Dept={{dept}}" target="_blank"><span class="glyphicon glyphicon-print"></span> Bulk Print </a>
    </div>

Open in new window

I changed it to this:
       
 <a class="btn btn-danger" onclick="setHref" target="_blank"></a>

Open in new window

And I added this JavaScript:
<script>  
    function setHref(term, campusid, faculty, dept) {
        var term = document.getElementById("term");
        if (Number(term) <= 20190)
            window.location.href = "../Survey/PrintSummaryPDFBefore2019?Term=" + term +
                "&Campus=" + campusid +
                "&Faculty=" + faculty +
                "&Dept=" + dept ;
        else
            window.location.href = "../Survey/PrintSummaryPDF?Term=" + term +
                "&Campus=" + campusid +
                "&Faculty=" + faculty +
                "&Dept=" + dept ;
        return false;
    }
</script>

Open in new window

But the debugger never even reaches this script. It seems that if a page is setup for AngularJS then it won’t parse regular JavaScript calls; I don’t know.

Then in the PrintSummaryPDF() function of the Survey controller, the previous programmer had code that parsed the Url, altered it to call a different function in the Survey controller, and then started a process like this:


Open in new window

0
ASP.NET Web Page Process.Start() not working in IIS?
0
I am receiving the following error always when this method is executed through Window Service whether when the same code is executed through Web Portal it is working Fine.

Could not create ssl/tls secure channel. c#


using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using System.Net;
using Newtonsoft.Json.Linq;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;


 void wc1TwoSample2()
        {
            try
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                delegate(Object sender1, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
                {
                    return true;
                };
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.DefaultConnectionLimit = 9999;
                //ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
                ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
                string URL = "https:URL";
                string param = "/api/v1/accounts";
                string resp = URL + param;
                var http = 

Open in new window

0
I want a list of checkbox items. As the user selects the items, I want them to appear in a list on the right.

If possible, I want each item to have a point value and as they select them, it totals the points selected.

Is there anything quick out there I can use in javascript, or jquery, or even asp.net?

I don't want to use a database or anything fancy.

(It's for a game I host where players earn points, pick prizes and screenshot me their selected list so I can give them their prizes.)

thanks!
0
Hi

I am getting the following error "oShaft      Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away"
There are three rows of data in the GridView. I have included the html for the GridView below.


            Dim oGridView As GridView = Me.GridViewData
           Dim oGridViewRow As GridViewRow
            For i As Integer = 0 To oGridView.Rows.Count - 1

                oGridViewRow = GridViewData.Rows(i)

                Dim lblShaft As Label = oGridViewRow.FindControl("lblShaft")
                oShaft = lblShaft.Text

Open in new window


<asp:GridView ID="GridViewData" runat="server" AllowSorting="True" AutoGenerateColumns="False">
             <Columns>
                 <asp:TemplateField HeaderText="Shaft" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="true" SortExpression="Shaft">
                     <ItemTemplate>
                         <asp:Label ID="lblShaft" runat="server" Text='<%# Bind("Shaft")%>'></asp:Label>
                     </ItemTemplate>
                 </asp:TemplateField>
                 <asp:TemplateField HeaderText="Site" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="true" SortExpression="Site">
                     <ItemTemplate>
                         <asp:Label ID="lblSite" runat="server" Text='<%# Bind("Site")%>'></asp:Label>
                     </ItemTemplate>
                 </asp:TemplateField>
                 

Open in new window

0
Hi,
how to deactivate session using C#. I don't want any web.configuration settings . I like to deactivate the session from C# code.

var sessionID = HttpContext.Current.Session.SessionID;
if (HttpContext.Current.Session["UserID"] == null) // for example....
              {
                  <<<NEED TO DEACTIVATE SESSION HERE>>>
              }

i tried Session.Abandon(), it is not working.

Kind regards,
Pooja
0
We have an issue when loading a website on our IIS server. Is anyone able to advise where we start in resolving this?

For reference, we have removed the server from the domain and re-joined it in the hopes this would help, but it hasn't made any difference.

IIS Server connects to a separate SQL server for its database.

error
We are also seeing an ASP.NET issue in the event log:

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/18/2019 1:54:10 PM
Event time (UTC): 7/18/2019 12:54:10 PM
Event ID: 9eec4075582648cbae1807c776b5b714
Event sequence: 8
Event occurrence: 7
Event detail code: 0
 
Application information:
    Application domain: /LM/W3SVC/1/ROOT/WebaBILLityPro-1-132079278328427605
    Trust level: Full
    Application Virtual Path: /WebaBILLityPro
    Application Path: C:\inetpub\wwwroot\WebaBILLityPro\
    Machine name: WEB-ABILITY
 
Process information:
    Process ID: 3068
    Process name: w3wp.exe
    Account name: IIS APPPOOL\.NET v4.5
 
Exception information:
    Exception type: Win32Exception
    Exception message: No authority could be contacted for authentication

 
 
Request information:
    Request URL: https://billing.intechtelecom.co.uk:443/WebaBILLityPro/Login.aspx?z=fafe553b-315e-4920-aecf-d35b4c72c6cb&z=fafe553b-315e-4920-aecf-d35b4c72c6cb 
    Request path: /WebaBILLityPro/Login.aspx
    User host address: 51.52.75.191
    User:  
    …
0
Hi all,

We are building an MVC website, and we would like to include some legacy functionality from a WebForms site.

So, we have our MVC view and we can load a webform into a DIV on the page, but when we post the webform, it goes to an incorrect url.

We have tried setting the postbackurl property of a button on the webform but this makes no difference.

Has anyone tried to do something similar before, and if so, did you have any success?

Is this even possible?

Any advice is much appreciated.

resourcesys.
0
jQuery UI DateTimePicker loses focus when selecting date with mouse.
Need focus on one of controls. Please test before writing, in IE.
Thanks.
0
I am using Visual Studio 2019 to develop an ASP.Net web API. In an API controller that provides data to user, I used HttpContext.Current.Application.Contents to work as data cache between different requests and different routes. The motivation of using HttpContext.Current.Application.Contents is to cache the data fetch/computed in previously incoming request. In most of the requests the API will just get data from HttpContext.Current.Application.Contents instead of fetching them from back-end, but in some requests the cache data will be cleaned up or initialized. Because multiple requests can be handled at the same time, how can I avoid race condition on using HttpContext.Current.Application.Contents?

Thank you!
0
I have developed a visual web part for SharePoint 2010, and the datepicker doesn't work in production. It works on the development server. I am using a DateTimeControl. In production, it just shows a white square instead of the calendar (see image).Screenshot of errorIn development I get a calendar, and in production I also get a calendar when I use a standard form.
0
Hi in ASP.net I am getting the error "Object Referenc not set to an instance of an object" in the following line of code.
The Gridview is definitely there and has data. What might cause this?

            For i As Integer = 0 To Me.GridViewData.Rows.Count - 1

Open in new window

0
ASP.net Web Work In Visual Studio How To Create an Efficient and FAST Setup To Develop...

Open to Any and All Tips that will help me develop DotNet websites faster and easier in Visual Studio...

So FAR... I do the following to be fast/efficient using VStudio .net coding  (not saying this is best or right way --  just providing a starting point)

I have THREE monitors...

Left Monitor has my CSS page and a minimized SQL Server Studio Management Software With my databases and tables to create update etc.

Middle Monitor has Visual Studio 2015 with HTML & ASP.net objects & Code Behind Page + HTML objects and Bookmark folder on my browser with links to
              StackOverflow, Microsoft Docs, and a lot of other DotNet resources... etc.

Right Monitor has Webpage(s) i am working on to see updates made in CSS or Code or HTML or where ever... and interactive web page cheat sheets minimized.

I have a notebook with Cheat Sheet for HTML and CSS printed out from helpful websites... mostly memorized but at my hand if needed

I have chrome developer tools ready to use to help see my or others CSS / HTM code development and to debug... Looking into to Firebug for JS debugging...

I use the Visual Studio block commenter buttons - for comment out comment in actions - to speed up  large comment in or out efforts

I use the Find button inside Visual Studio to see if CSS styles are being used or not in my HTML by searching ALL open …
0
In my JS file, i am able to retrieve the data from backend to the variable : IsAvailable

IsAvailable will return true or false based on back end value.

I am able to bind the data from JS file to CSHTML

  <div class="col-md-9 bold">
        <span id="test" data-bind="text:IsAvailable"></span>
    </div>

Open in new window


How to define the If condition whether the variable:IsAvailable = true or false to show the corresponding div tag?

I tried with following code, but didnt work exactly...

cshtml file

<div class="myoutercls">
                @if (Model.IsAvailable == True)
                {
                    <div class="mycls">
                    <a class="envelope" href="javascript:void(0)">
                     <span class="glyphicon glyphicon-envelope"></span>
                      <span>Envelope</span>
                  </a>
                <a class="search" href="javascript:void(0)">
                    <span class="glyphicon glyphicon-search"></span>
                    <span>Search</span>
                </a>
                <a id="save" class="fr" href="javascript:void(0)">
                    <span class="glyphicon glyphicon-print"></span>
                    <span>Print</span>
                </a>
                    </div>

                }

                @if (Model.IsAvailable == False)
                {
                    <div class="mycls">
                    <a class="envelope" href="javascript:void(0)">
                     

Open in new window

0
What is the future of VB.NET with .CORE?

Is .CORE only supporting C#?

Is VB.NET becoming obsolete?

Is .CORE replacing webforms?

What is the future of vb.net and webforms?

thanks!
0
I have some questions about latest technologies:

1. I only load bootstrap for when I have a control that requires it. Otherwise, I try to steer clear of using bootstrap for new things. We have a new developer who is pushing bootstrap for everything.

I see it as a heavy library that has kind of had its day and there are newer solutions.

Educate me please.

thanks!
0
I have a ASP.NET application that looks great on the desktop; however, when I view the same web app on my cell phone.  YIKES!

Are there any must-have settings for a ASP.NET application to appear on the desktop and mobile devices without issues?
0
Hi

In ASP.net I need to have a tooltip for the header of a GridView template column. Not for the gridview cells but for the header.

           <Columns>
                            <asp:TemplateField HeaderText="ID" SortExpression="ID" >
                                <ItemTemplate>
                                    <asp:Label ID="lblID" runat="server" Text='<%# Bind("[ID]")%>' ToolTip="ID"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>

Open in new window

0

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