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 am trying to validate the presence and pattern of a field defined in an asp. net page.
The presence of the field works but when I enter the telephone number in the
field for pattern matching, it does not work. I get the error message.

Please advise,
Isaac

<div visible="true" id="divTelephoneNumber" runat="server">
                  <div class="col-xs-12 col-md-8 col-sm-10 col-lg-6 nill">
					<asp:Label ID="lblTelephoneNumber" runat="server" AssociatedControlID="txtTelephoneNumber" Text="Telephone number *" CssClass="control-label" />
                      <br />
					<asp:TextBox ID="txtTelephoneNumber" runat="server" CssClass="form-control" MaxLength="20" aria-label="Telephone number" ></asp:TextBox>
					<span class="required"></span>
                    <asp:CustomValidator id="rfVTN" runat="server" ControlToValidate="txtTelephoneNumber"  ValidateEmptyText="true" ErrorMessage="Telephone Number is a required field. nnn-nnn-nnnn " ClientValidationFunction="ValidateTelephone"/> 
                  </div>
                </div>            



 <script type="text/javascript">
       function ValidateTelephone(sender, args) {
           var compare = RegExp("/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/");
           args.IsValid = compare.test(args.Value);
           return;
       }
</script>        

Open in new window

0
Why Diversity in Tech Matters
LVL 13
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

I have an asp.net web forms website with master page and few other pages.

In master page, i have <asp:ContentPlaceHolder ID=“Placeholder1” runat=“server”></asp:ContentPlaceHolder> , where the content of the child pages are loaded.

one of the page is default.aspx ,, as such

<asp:Content runat=“server” ID=“content1” ContentPlaceHolderID=“Placeholder1”></asp:Content>

I want to change default.aspx , such that I have a side menu column and a content column. Aslo I have a anchor tag. I wrote a javascript/jquery function as such on documen t ready

$("#togglemenu").on(click, function(){
    $("sidemenu").toggle("slow");
}

the toggle works, but in the main content section , i have a table and can increase the size of the rows displayed in the table, when I change the pagenumber or change the number of items displayed in the table, the page refreshes and it doesn't maintain what state the sidemenu was in . I.e even if the menu was hidden, when i change the page number, the page refreshes and side menu appears . I want it to be hidden , if the user had hidden the menu and then changed the page number.

how can i achieve this in asp.net web forms.


<asp:Content runat=“server” ID=“content1” ContentPlaceHolderID=“Placeholder1”>

<a >  <span id="togglemenu" > Hide menu </span></a>
<div id="sidemenu">
</div>

<div id="main content"> </div>

</asp:Content>
0
https://stackoverflow.com/questions/32470906/how-to-upload-a-image-in-asp-net-mvc-using-ajax-request

I use above codes to upload a file. but if I want to add a parameter from <input type="text" id="firstname"> to ajax like below. How can I do that? Basically, I upload the image but I also want to update the database behind.


type: "POST",
           url: '/Home/Upload',
           data: formData, document.getelementid("firstname").value,
           dataType: 'json',
           contentType: false,
0
I'm working on a Windows Forms project and it calls Web Services. This is how the project is setup (my new job)

1. The Windows Forms solution
2. Web Services solution
3. Windows Forms solution has references to the Web Services . Screenshot below (not the best naming convention, I know)
e1.png
4. I downloaded Fiddler to see if I can see what Web Services method is being called. I see some logging but not Web Services.

Anyway I can see  which web services method is being called?
0
I have a task that requires me to receive a RARP request with  MAC address and then to send out a RARP Response mapping that MAC to an IP. I understand the concepts behind RARP but am simply having an issue finding examples for building RARP packets in C#. I was wondering if anybody can point me in the right direction for building the actual packet.
0
I have an legacy asp.net web forms project that I inherited.

is there a way to have multiple views, similar to MVC projects in asp.net.
I have a use case where the HTML markup is simplified for certain users/cases and I want to be able to create a different view/aspx page that I can server based on permissions.

is this possible?
0
I have an asp.net web forms applications that I want to host with a two different URLs , but same domain name.
say, one is abc.mycompany.com and other one xyz.mycompany.com. if possible, i want to deploy my application in one location but can be accessed via two different URLs.

Also, can we set something in IIS or web.config file of the application such that, users coming from abc.mycompany.com are directed to abc.aspx page in the application and
others to xyz.aspx.com ?
1
I am trying to publish my app via vs2013, but the publishing errors
on my master pages. Can someone tell me what is missing.
The app runs perfectly when I run it locally

The following are the errors:
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/7200.master(1,0): Error ASPPARSE: The file '/master/7200.master.cs' does not exist.
/master/common.master(1,0): Error ASPPARSE: The file '/master/common.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.
/master/720.master(1,0): Error ASPPARSE: The file '/master/720.master.cs' does not exist.

See Attached.  Down to the wire.

Isaac

partial class master_720 : 

Open in new window

0
I have a chart control in asp.net that I am trying to display annotation in the chart area - topcenter of 'ChartArea1'.  It does not display on the chart.

Why?

Below is my asp.net code

<Annotations>
                                        
                                            <asp:TextAnnotation Alignment="TopCenter" Font="Arial, 10pt" ForeColor="#00FFCC"
                                                Name="Chart1Annotation" Text="Nominal" TextStyle="Default" ClipToChartArea="ChartArea1">
                                            </asp:TextAnnotation>
                                        </Annotations>

Open in new window

0
Hi I am using Authorize.net for payment gateway in my Asp.net code, It suddenly stopped working few days back, I want to fix that immediately, Please help me,
I am getting error on below line
myWriter = new StreamWriter(objRequest.GetRequestStream()
Error is The exception message is 'The request was aborted: Could not create SSL/TLS secure channel.'. See server logs for more details.
Here is code, My windows machine is Windows server 2008 and I have installed Framework 4.5.

    I tried to setup that on Windows server 2012 R2 and it is working fine there, Problem is in current Production machine which is 32bit machine, Is Authorized.net not compatible with 32 bit machine? Please let me know.

 
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
        String ApiLogin = System.Configuration.ConfigurationManager.AppSettings["ApiLoginL"];
        String TransactionKey = System.Configuration.ConfigurationManager.AppSettings["TransactionKeyL"];

    
        String post_url = "https://secure2.authorize.net/gateway/transact.dll";

        Dictionary<string, string> post_values = new Dictionary<string, string>();

        post_values.Add("x_login", ApiLogin);
        post_values.Add("x_tran_key", TransactionKey);
        post_values.Add("x_delim_data", "TRUE");
        post_values.Add("x_delim_char", "|");
        post_values.Add("x_relay_response", "FALSE");

        post_values.Add("x_type", "AUTH_CAPTURE");
        post_values.Add("x_method", 

Open in new window

0
Become a Certified Penetration Testing Engineer
LVL 13
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Hi I am using Authorize.net for payment gateway in my Asp.net code, It suddenly stopped working few days back, I want to fix that immediately, Please help me,
I am getting error on below line
myWriter = new StreamWriter(objRequest.GetRequestStream()
Error is The exception message is 'The request was aborted: Could not create SSL/TLS secure channel.'. See server logs for more details.
Here is code, My windows machine is Windows server 2008 and I have installed Framework 4.5.

 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
        String ApiLogin = System.Configuration.ConfigurationManager.AppSettings["ApiLoginL"];
        String TransactionKey = System.Configuration.ConfigurationManager.AppSettings["TransactionKeyL"];

   
        String post_url = "https://secure2.authorize.net/gateway/transact.dll";

        Dictionary<string, string> post_values = new Dictionary<string, string>();

        post_values.Add("x_login", ApiLogin);
        post_values.Add("x_tran_key", TransactionKey);
        post_values.Add("x_delim_data", "TRUE");
        post_values.Add("x_delim_char", "|");
        post_values.Add("x_relay_response", "FALSE");

        post_values.Add("x_type", "AUTH_CAPTURE");
        post_values.Add("x_method", "CC");
        post_values.Add("x_card_num", OrderD.CARDNUMBER);
   
        post_values.Add("x_card_code", OrderD.CVV);
       
        post_values.Add("x_exp_date", OrderD.MONTH + "" + OrderD.YEAR);…
0
I am setting up a bamboo deployment plan for asp.net website .

How can I build/publish the asp.net website with msbuild command.

also, when I build right now with visual studio, the build output is written to a  "compiledweb" folder inside the project folder.

I'm trying to see where is this path set, is it in the solution file, or web config or any other file?
0
test.aspx
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        Session("MyName") = "ravikant"
    End Sub

Open in new window

global.asax
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
'MsgBox(System.Web.HttpContext.Current.Session("MyName"))
        
        Dim lastError As Exception = Server.GetLastError()
        If (lastError IsNot Nothing AndAlso lastError.Message <> "File does not exist.") AndAlso (lastError.Message <> "Thread was being aborted") AndAlso (lastError.Message <> "The client disconnected.") Then
            Dim xCl As New CommonClass
            xCl.SendMail(lastError, HisIp)
End Sub

Open in new window


commonclass

Public Sub SendMail(ByVal i_oErr As Exception, ByVal ClientIp As String)
        Try
--not getting session here
MsgBox(System.Web.HttpContext.Current.Session("MyName"))
Catch ex As Exception
end try

Open in new window


Actually I need the session value on error.  So that it will send an error mail  with the user's login details. But I am not getting session value neither on global.asax nor on class
0
SBS 2011  with exchange 2010 showing error asp.net 2.0 50727.0  event ID 1310

can you please help to solve     as new  user account on outlook 2016 not auto discovering

System

  - Provider

   [ Name]  ASP.NET 2.0.50727.0
 
  - EventID 1310

   [ Qualifiers]  32768
 
   Level 3
 
   Task 3
 
   Keywords 0x80000000000000
 
  - TimeCreated

   [ SystemTime]  2019-04-03T21:23:05.000000000Z
 
   EventRecordID 7403448
 
   Channel Application
 
   Computer SBS .local
 
   Security
 

- EventData

   3008
   A configuration error has occurred.
   03/04/2019 22:23:05
   03/04/2019 21:23:05
   7e417ab6dad34a55b9bc5ce31f52a32a
   1
   1
   0
   /LM/W3SVC/1/ROOT/Autodiscover-1495-131988001853476116
   Full
   /Autodiscover
   C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Autodiscover\
   SBS
   
   25148
   w3wp.exe
   NT AUTHORITY\SYSTEM
   HttpException
   Could not load file or assembly 'Microsoft.Exchange.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Autodiscover\web.config line 940)
   https://mail.domain.com:443/Autodiscover/Autodiscover.xml
   /Autodiscover/Autodiscover.xml
   192.168.1.19
   
   False
   
   NT AUTHORITY\SYSTEM
   27
   NT AUTHORITY\SYSTEM
   False
   at …
0
With all our web grids (mainly data entry aspx pages) we load a DB DataSet into a Session variable and display it on fields and one or more grids. The user makes changes to fields, can sort, edit, and filter the grids, etc., during which we update the Session variable. They click Save and the DB is updated with the modified DataSet in the Session variable. It's slick and no problem.

Now we have users opening up the same page in separate browser windows and it's a disaster. The user opens Record A on one page, makes changes, but before they save, in the other browser, they look up other records to verify information, or they pull up Record B and start making changes. Then they go back to the other page. At minimum, when they sort a grid, Record B info is now there, or worse, they click Save, updating Record B with changes intended for Record A.

This never occurred to us, and we're not sure what to do. We tried assigning the DataSet to ViewState, but that too easily gets cleared when sorting columns or doing anything else. And changing the Save button to re-load all data for that page's Key, then assign all the page data to every DataTable, DataRow, and DataColumn, would be a monumental task, and still doesn't fix losing data when re-sorting grids unless it's in the Session. We thought about generating a random Session name for a page's instance (maybe onto a hidden field) but that may get cleared, and even if it worked, it'd eat up lots of Session memory over time.

So…
0
We are developing a NetCore application.  It uses query strings in several places to pass IDs.
What is the best way to hide the querystrings on the browser. I know there is some way of encrypting the whole URL so the parameters are not visible. Can this be done with an IIS setting or third party software?
0
Hi

I am getting a Compilation Error in the following code in my ASP.net wen form. The JavaScript shown further down runs fine in the button click shown
in the second piece of code

  <asp:RadioButton ID="RadioButtonSimple" OnCheckedChanged="showLoading();"  runat="server" AutoPostBack="True" Checked="True" 

Open in new window


                              <asp:Button ID="btnClear" runat="server" BackColor="White" CssClass="roundedCornerBigButton" ForeColor="#000066" Text="Clear" Width="200px" OnClientClick="showLoading();" />

Open in new window


   	<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script type="text/javascript">
		//<![CDATA[
	    function showLoading() {
	        $('.pleaseWait').show();
	    }
		//]]>
       </script>

Open in new window

0
We have been using an old program that does the following:

1) Using a .aspx page the user input a serial number and clicks a button
2) The code determines the necessary label information and writes it to a database table
3) The user clicks a hyperlink on the .aspx page that executes a batch file.
4) The batch file calls the label printing software and prints the label.

When trying to do the same thing in IIS 8.5, the batch file can't be executed.

We have the application pool in IIS set to use Network Service account and the network service account has permissions to run the batch file.

Any ideas why this wouldn't be working?
0
I need to build a aspx page that collects data.
On the page I have a dropdown for the number of people attending the event.
I want a dynamic  form that requests attendees information, but only for the number of attendees.
This has to live in the .net world
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 would like to bind a custom tag helper to any tri-state value in my database.

There are many tri-state (bool?)s in my database.

On my edit pages, I would like a single control to handle all of these values.

Here is my custom taghelper

using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System.Collections.Generic;

namespace TESCore.Web.TagHelpers
{
    [HtmlTargetElement("tristatelist")]
    
    public class TriStateListTagHelper : TagHelper
    {
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = null;

            output.Content.AppendHtml("<select class='tri-state list-box form-control'>");
            output.Content.AppendHtml("<option value=@null>Global</option>");
            output.Content.AppendHtml("<option value='true'>True</option>");
            output.Content.AppendHtml("<option value='false'>False</option>");
            output.Content.AppendHtml("</select>");
        }
    }
}

Open in new window


Below is an example of the an edit page. Notice I've hand-coded individual controls for the EmployeeType.ForceClockOut and EmployeeType.UseComptime.

Notice I'm trying to use my custom tristatelist taghelper on the EmployeeType.AllowClockOut bool? using the asp-for tag. The asp-for tag is not working to bind the data.

@page
@model TESTimeClock.Pages.Manager.EmployeeType.EditModel
@*@{
        ViewData["Title"] = "Edit";
    }*@

Open in new window

0
I've written a C# asp.net application that uses Microsoft.Office.Interop.Excel.  Application creates an Excel spreadsheet, saves it and then tries to close and quite Excel but the Excel process is still running in the Task Manager.  (same code works in a console app or Windows Forms application but not in my asp.net web app).

Here is the basis of the code:

using MyExcel = Microsoft.Office.Interop.Excel;
.
.
.
MyExcel.Application xlApp;
MyExcel.Workbook xlWorkBook;
MyExcel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
.
.
 xlApp = new MyExcel.Application();
 xlWorkBook = xlApp.Workbooks.Add(misValue);
 xlApp.DisplayAlerts = false;
 xlWorkSheet = (MyExcel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
 xlWorkSheet.Name = "Daily Report";
.
.
xlWorkBook.SaveAs(myFile, MyExcel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, MyExcel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close();
xlApp.Quit();

Open in new window

0
I am getting an error when deploying my site to IIS on a machine with just .NET 4.0, but using entity Framework 6.0 and .NET 4.0 for the build.  "No Conceptual Schema node to embed as a resource".  

I try to look at things for the site in IIS and get the error message under .NET Compilation of "Cannot add duplicate collection entry of type 'add' with unique key attribute 'extension' set to '.edmx'.  

Runs fine in Visual Studio 2017.  Please help.

<buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
       ------> <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
      </buildProviders>

Open in new window

0
How do I easily passing information from a database to  model and then to the view without using binding, i am using mvc 4.0
0
How do I allow users of my application developed in VB.NET to send email using the application?

The application generates an invoice, I would want the user to send that invoice through the application and using his email account as a form address.

Thank you, Anthony
0
I have mailchimp call from API.
but I do not know how to show the value on the aspx.

Can you show me how to do that?


{ "members": [ {
    "id": "f777bbffab8d1ceca8b757df63c47cb8",
    "email_address": "urist.mcvankab+1@freddiesjdfasdfokesasdfds.com",
    "unique_email_id": "882e9bec19",
    "status": "subscribed",
    "merge_fields":{
        "FNAME": "",
        "LNAME": "" },
    "interests":{
        "9143cf3bd1": true,
        "3a2a927344": false,
        "f9c8f5f0ff": false,
        "f231b09abc": true,
        "bd6e66465f": false },
//And so on...



public static List<mailchimp> DeserializeAccounts(string json)
        {
            return JsonConvert.DeserializeObject<List<mailchimp>>(json);
        }

public class mailchimp
    {
        [JsonProperty(PropertyName = "id")]
        public string id { get; set;}

        public mailchimp()
        {
            // Setting default values here
            // With C# 6 we could use auto property initializers above instead!
            id = "-1";            
        }
    }
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