ASP.NET

124K

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 there!

The code below is all there is in a asp.net vb page, that is called when the user must receive an e-mail with registration data.

I am not familiar with asp.net , therefore I created the page based on some googling...

It doesn´t work, but I believe (and hope) the error is simple. Could someone change it to make it work?  

Thanks,
fskilnik.

<%@ Page Language="VB" %>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<%@ Import Namespace="System.Net.Mail" %> 
	
<script runat="server"> 
    
    MailMessage msg = new MailMessage();
        msg.From = new MailAddress(TxtEmail.Text);
        msg.To.Add("[b]contact@hostandservers.com[/b]");
        msg.Subject = TxtSub.Text;
        msg.Body = TxtMsg.Text;
        msg.IsBodyHtml = true;
        // MailMessage instance to a specified SMTP server
        SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);
        smtp.Credentials = new System.Net.NetworkCredential([b]"yourgodaddyemailusername, "godaddyemailpassword"[/b]);
        smtp.EnableSsl = false;
     
        // Sending the email
        smtp.Send(msg);
        // destroy the message after sent
        msg.Dispose();
        LitMsg.Text = "Thanks for email us.. will get back ASAP..!";
        TxtEmail.Text = "";
        TxtMsg.Text = "";
        TxtSub.Text = "";
        TxtName.Text = "";
</script> 
<html> 

Open in new window

0
Cloud Class® Course: Microsoft Azure 2017
LVL 12
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

In Visual studio, is it possible to make a Windows Form Desktop application that can also be executed from a Mac?  Or can that only be done from making a web page such as ASP.NET Web Application
0
On my page Default.aspx

I have a asp button like this:

<asp:Button ID="Button2" runat="server" Text="Button" />

On this page Default.aspx.cs

The server side click event for the button is this:

protected void Button2_Click(object sender, EventArgs e)
{

}

If I have a html button like this on this page Default.aspx

<input id="Button1" type="button" value="button" />

How do I call the Server-Side click event for it?
0
I have an asp.net project . I want to version the JavaScript files, when there are any new changes to those files , so that browser downloads the latest .

Are there any tools/ nuget packages for this ?
0
I am converting my VB6 desktop app to VB.NET and ASP.NET so that I can "webify" the application I have.  What is the best way to begin learning?  I downloaded and installed the Community Edition of Visual Studio.  Should I start googling ASP.NET first or VB.NET first?  How will this actually play out?  Will I end up having to learn both at the same time since they are tied?  What exactly is the relationship between the two?

Also will I need to know HTML and any other languages?  At the end of the day, I am only looking to convert about 6 screens in my VB6 app to .NET so that it can be accessed from more users and even Mac users.

Thanks
0
Hi experts,

I'm using the Telerik UI for ASP.NET AJAX RadWindow.
https://demos.telerik.com/aspnet-ajax/window/examples/overview/defaultcs.aspx

I'm using ASP.NET and VB.

I saw this example here for passing a parameter from the Main page to the RadWindow:

Using RadWindow as a Dialog
https://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/using-radwindow-as-a-dialog

I recreated this example and it works fine.

This is the working code:

RadWindow1_MainPage.aspx

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

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">

        // https://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/using-radwindow-as-a-dialog

        // The OnClientShow event handler sets the argument to the dialog being opened
        function clientShow(sender, eventArgs) {
            // When the showRadWindow1 button is clicked the value from the textbox is pass to RadWindow1 as an argument
            var txtInput = document.getElementById("txtInput");
            sender.argument = txtInput.value;
        }
        // The OnClientClose event handler receives the result of the dialog and responds
        function clientClose(sender, args) {
        

Open in new window

0
Im getting started to learn VB.NET and ASP.  I am coming from a background with some experience in VB6.  

What software tools do I need in order to develop a webpage with VB.NET and ASP?  Do I need a specific web server from Microsoft?  If so, what version?  Do I need Visual Studio?  If so, what version.  What is needed to begin setting up ASP?  Is that automatically built-in to the web server?

Also, what is the difference between ASP and ASP.net, if any?

Thanks
0
I am trying to use HttpClient in C# as below:

using (HttpClientHandler handler = new HttpClientHandler())
{
         handler.UseDefaultCredentials = true;

         using (HttpClient _httpClient = new HttpClient(handler))

Open in new window


I understand that HttpClientHandler has "UseDefaultCredentials" property.
so what is "UseDefaultCredentials"?
And if "UseDefaultCredentials" is set to true, what does that mean?
0
Can someone recommend a good image resampler?  I need to reduce the size of several jpeg files to be display in an ASP.NET application.
0
ASP.Net MVC 5

I am trying to fetch the result from Jquery to my controller.

However, in my controller - ActionResult is not invoking.   What could be the reason ?

        [HttpGet]
        public ActionResult ActionName(string id)
        {
            // do something
            var vm = id;
            return View(vm);
        }

JQuery Syntax :


   $('button').click(function () {
        var btn = $(this).attr('id');

        alert(btn);

        $.ajax({
            type: 'GET',
            url: '@Url.Action("ActionName", "ControllerName")',
            data: { id: btn },
            success: function (result) {
                // do something
            }
        });
    });
0
Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

How to pass Jquery variable value to c# mvc?

I need to fetch the value of the variable btn in mvc code behind.

$("button").click(function ()
    {
        var btn = this.id;
        if (btn == "previewButton")
        {
          alert(btn);

        }
  }

Open in new window


Based on the variable value (Submit Button (or) Preview Button), my model will have Required validation on certain fields.
0
Can someone recommend a good image compressor?  I need to compress several jpeg files to be display in an ASP.NET application.

Thanks
0
How to handle Required field validation in Jquery for radiobuttons in asp.net mvc?

Currently, I am handling it in the Model
view \ create.cshtml page

   
<div class="col-sm-3 checkbox-inline">
                        @Html.RadioButtonFor(model => model.IsDateChanged, 1, new { @Id = "IsDateChangedYes" })
                        <label class="hthin" for="IsDateChangedYes">Yes</label>
                        @Html.RadioButtonFor(model => model.IsDateChanged, 0, new { @Id = "IsDateChangedNo" })
                        <label class="hthin" for="IsDateChangedNo">No</label>
                        <span asp-validation-for="IsDateChanged" class="text-danger"></span>
                    </div>

Open in new window



viewmodel \ mymodel.cs

 [Required(ErrorMessage = "Required")]
        [Display(Name = "1. Have there been any changes in the date?")]
        public int? HasDateChanged { get; set; }

Open in new window

0
Asp.net
Vb.net

A page with a list of transaction is loaded
A textbox
A command button

The visitor enters the email in the textbox and clicks the command button, as a result the currently displayed page is sent to the entered email

How to get the currently displayed page text, tags, script .....      in a string to be used for email body

The code is

        Dim smtp As New System.Net.Mail.SmtpClient()
        Dim smail As New System.Net.Mail.MailMessage
        smail.To.Add(New System.Net.Mail.MailAddress(TextBox1.Text))
        smail.From = New System.Net.Mail.MailAddress("MyEmail@gmail.com", "subject")
        smail.Subject = "Subject"
        smail.IsBodyHtml = "true"
        smail.Body = (this part is needed)
        smtp.EnableSsl = True
        smtp.Send(smail)

Thanks
0
Hi

In my ASP.net web app I want a user to be able to download an Excel file that I have in my resources.
What VB.net code would I use behind a  button click for this
The Excel file is called Steel.xls
It is a 97 to 2000 Workbook
0
I'm using ASP.NET Web Forms and VB.
I'm using Sql Server.
I'm using the DataGrid control. Yes I know the newer grid is GridView, but I need to do this with DataGrid.

I'm using the Employees table from the Northwind database.

Here is the script to create the table:

USE [Northwind]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employees](
	[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
	[LastName] [nvarchar](20) NOT NULL,
	[FirstName] [nvarchar](10) NOT NULL,
	[Title] [nvarchar](30) NULL,
	[TitleOfCourtesy] [nvarchar](25) NULL,
	[BirthDate] [datetime] NULL,
	[HireDate] [datetime] NULL,
	[Address] [nvarchar](60) NULL,
	[City] [nvarchar](15) NULL,
	[Region] [nvarchar](15) NULL,
	[PostalCode] [nvarchar](10) NULL,
	[Country] [nvarchar](15) NULL,
 CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET IDENTITY_INSERT [dbo].[Employees] ON 

INSERT [dbo].[Employees] ([EmployeeID], [LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate], [HireDate], [Address], [City], [Region], [PostalCode], [Country]) VALUES (1, N'Davolio', N'Nancy', N'Sales Representative', N'Ms.', CAST(N'1948-12-08T00:00:00.000' AS DateTime), CAST(N'1992-05-01T00:00:00.000' AS DateTime), N'507 - 20th Ave. E.
Apt. 2A', N'Seattle', N'WA', N'98122', N'USA')
INSERT [dbo].[Employees] ([EmployeeID], 

Open in new window

0
Hi team,

How to validate square bracket '[ and ]' in JavaScript (regular expression).

I have a textbox having value like this. So, I need a regular expression which will tell me square bracket is present in the textbox or not.

If there is a square bracket present in the textbox it will give me a error message.

[ABC  ESS080820183171][CTK  ESS080820189505][TROUS  ESS080820183485][SIMINESS  ESS080820184038][RAMMMM  ESS080820185998]
0
I have a need to create data URI's for my images so that I can set the SRC attribute as the data URI in an IMAGE tag. I found the following function online, but am getting the error "URI formats are not supported.". Any suggestions on how to fix this?

imgFile is in the format of:

http://www.abc.com/someFileName.jpg

here's my code:
        public static string GetDataURI(string imgFile)
        {
            return "<img src=\"data:image/"
                     + Path.GetExtension(imgFile).Replace(".", "")
                     + ";base64,"
                     + Convert.ToBase64String(File.ReadAllBytes(imgFile)) + "\" />";
        }

Open in new window

0
I have a website where the number of visitors is increasing and it is facing a poor response time. I am not a server specialist and for this reason I want to expose my issue here to receive some feedback. The website has the following characteristics:

* Developed with ASP.NET Web Forms (I will be implementing a new version with ASP.NET MVC soon).
* It uses a PostgreSQL 9.1 database.
* It is 100% dymanic which means that every page is formed at run-time getting information from the DB.
* Hosted in a cloud server with 2 Cores and 4 GB of RAM.
* Windows Server 2012 in drive C:
* PostgreSQL DB in another "hard disk" as drive D:
* The average number of daily visitors is 2,500

Watching the Task Manager I can notice that there are many PostgreSQL processes which consume CPU 100%. Another process that is shown in the "IIS Worker Process" but I have not seen it as critical as the PostgreSQL process. So it seems that the main issue here has to do with the database access. When CPU usage is high the website response is extremely low and also it is very difficult to establish a remote desktop connection.

I have thought about upgrading the cloud server to, for example, 4 cores and 8 GB of RAM, but firstly I want to get feedback from experts here so I can take the best approach. I am not a server expert and, for this reason, I do not want to take steps blindly.

Respectfully,
Jorge Maldonado
0
Cloud Class® Course: C++ 11 Fundamentals
LVL 12
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

In a C# asp.net application I have an asp dropdown list, asp label and asp textbox.  The dropdown list is populated in the codebehind on page load.  I would like to hide/show the label and textbox when a user changes the value in the dropdown list based on the selected value using jquery or javascript or anything else that may work without reloading the page.
0
Hi experts,

I created a Web Forms example create I fill out some textbox and then use a Sql Server stored procedure to insert the records into a Sql Server table.

I'm using ASP.NET Web Forms and Visual Basic.

This is the script to create the table in my example:

USE [TestDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employees](
	[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
	[LastName] [varchar](50) NOT NULL,
	[FirstName] [varchar](50) NULL,
 CONSTRAINT [PK_Employees_1] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

Open in new window


This is the script to create the stored procedure in my example:

USE [TestDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Employees_Insert]
(
    -- parameters
    @LastName Varchar (50),
    @FirstName varchar (50)
)
AS
BEGIN

INSERT INTO [TestDatabase].[dbo].[Employees] (LastName,FirstName) values (@LastName, @FirstName)

END

GO

Open in new window



This is the Code for Default.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>
    <style type="text/css">
        .boydbg1 {background-color: #ffffff; color: #000000;}
        .ColAlignCenter { text-align:

Open in new window

0
This is related to the question I asked here. Mark Wills and Chinmay had great input.

https://www.experts-exchange.com/questions/29110740/Sanity-check-for-the-dymanic-Report-code-ex-developer-wrote.html#a42634519

I looked at the links Mark has in the question above. My manager is going round and round.

We have a Query Builder custom page that the ex-developer built. I've cleaned it up a lot. Just one more section that needs to be changed (ex-developer has hardcoded IDs and I need to change that).  I'm taking Mark's advice and just cleanup one more section and take the approach of "it works".
Now, my manager says we need to look at a 3rd party tool.
Things to consider.
a. it has to be part of our website. User can't open a new tool. It has to sit on our data and integrated into our website Like drop-in controls..similar to Telerik maybe (I've used Telerik and it wasn't felxible)
b. User searches something somewhere else in the code , for example, for an invoice. We want to save that query for the user and plug it in the reports page and automatically bring up the report
c.  We need to adapt this code and make it work for other sections. For example, it works for "Assets". Now we need to make it dynamic enough to work for "Invoice" section of site.
d. My manager is in a rush. Geez.

I looked at EasyQuery that Mark mentions https://korzh.com/easyquery

Is there a Query Builder tool that's like controls...we can drop into our website and …
0
I have a grid view on a master page that is in an update panel which is in a panel and this is used with a popup extender.  The gridview works ok, but the 'Done' button returns an error when trying to close the popup after making changes to the Grid view with the row commands.  This has to do with the post back, but I don't know how to fix.  The 'Done' button works fine if I don't make any changes to the grid view.  I have left the page EventCausesValidation=true by default.

This is the error:  
JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Please help.  Thanks

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
        If IsPostBack = True Then
            
        Else
            

            CoreQuestDataSource.DataBind()
            CoreQuestGrdVw.DataBind()

           
        End If


    End Sub

Open in new window


Protected Sub CoreQuestGrdVw_RowCommand(ByVal sender As 

Open in new window

0
Using  asp.net

File1.aspx, File2.aspx, File3.aspx

Are using    Sub Action(variable)

How to make (Sub Action) accessible  by   File1.aspx, File2.aspx, File3.aspx
0
I have an asp.net project that I'd like to add the menu control to, but when I do, and I add a sitemapdata source, the page always gives me an error, like this:

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'CODE2017' (using password: NO)

Source Error: 


Line 283:    <siteMap>
Line 284:      <providers>
Line 285:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286:      </providers>
Line 287:    </siteMap>

Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config    Line: 285 

Open in new window


I don't know why it's referencing MySql, the site uses MS Sql and works well otherwise, but when I inspect the machine.config file, sure enough, only that one sitemap provider is listed.

I cannot find any documentation to get me past this, does anybody have a suggestion?

Thanks!
0

ASP.NET

124K

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