Sending mail using classic asp - html

I am new for classic asp.
I have written simple code to send mail using classic asp as follows :
HTML Code:
<!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">
<head>
<title></title>
</head>
<body>
<form method="post" action="ASPformEmailResults.asp">
<p><input type="submit" name="submit" value="Submit"/></p>
</form>
</body>
</html>
ASP page:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="a#gmail.com"
myMail.To="b#gmail.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>
<html>
<head>
<title>My First ASP Page</title>
</head>
<body bgcolor="white" text="black">
</body>
</html>
but whenever open html page & click on submit button then mail should sent to given id but it displays asp page content.
Please help me to solve this problem.
Thank You.

Based on the information given, it appears that although IIS is installed, the ASP parser itself is either disabled or unmapped.
The following instructions will enable it for Windows 8; other versions of Windows will be similar:
From the Start screen, search for "Turn Windows features on or off"; it will be under 'Settings'.
Expand 'Internet Information Services'
Expand 'World Wide Web Services'
Expand 'Application Development Features'.
Tick 'ASP'.
Click 'OK', and ASP will be enabled within IIS.
If it is installed, it may well be disabled. Load up the IIS Manager (either through the start screen, or by running inetmgr directly from Start, Run, then:
Expand your computer name
Expand 'Sites'
Click on 'Default Web Site'.
Click on 'Handler Mappings'.
Ensure that the mapping ASPClassic is enabled for *.asp; if it isn't, you will need to create it and ensure that its executable is set to %windir%\system32\inetsrv\asp.dll.

Related

Send .txt folder from path HTML

I have this codes:
<!DOCTYPE html>
<html>
<head>
<title>Main</title>
</head>
<body bgcolor="Cyan">
<center>
Click me to send your log errors to developer.
</center>
</body>
</html>
The log file is located at C:\Users\aimst\AppData\Local\log.txt.
Also I want to Hide this:
Thanks for help <3
This is not possible with pure html. Html only offers you a shortcut to sending an email yourself as a user. This is like giving an email template for users. I think you want to send an email from your server to a knwon adress. So "the website" sends a filled email. For this you need any kind of server-side programming because the server sends the email, not a user via his mail server.
PS: Note that the html tags center and the attribute bgcolor both are deprecated. Use CSS for both. The background property replaces the bgcolor attribute. Centering elements is a little bit more tricky but one solution is using flex layout. This post shows an example and also other possibilities how to center an element. (In my opinion flex is the best solution because is supported in most of the browsers now and it is not any kind of workaround but the intendet functionality.)
Because I know php here is an example code in php. This is also possible to write in any other language like python, java, javascript, ...
Html file:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<form action="sendmail.php">
<input type="submit" value="Send your log errors to developer." />
</form>
</body>
</html>
CSS file style.css
body{
background: cyan;
}
form{
display: flex;
justify-content: center;
}
PHP sendmail.php file
<?php
$message =
"The following logs have been sent by a user:\n\n".
file_get_contents("C:\Users\aimst\AppData\Local\log.txt");
mail("yourname#example.com", "Error Logs", $message);
?>
Note that you need any php server running for this, for example Apache XAMPP.

input type tag missing in browser when tested through wordpress

I've started coding html in wordpress. I have a html code with label tag and an input tag of type "text". The input field is not getting displayed in browser. The same code works fine in eclipse. What might be the problem. When I save the post as draft the tag disappears. Not able to solve the issue. Kindly help me in this regard.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello testing</title>
</head>
<body>
<div> <label> Name:</label> <input type="text"> </div>
</body>
</html>
Above image is the code run through eclipse
Above one is the image run through wordpress preview
when writing html in the Wordpress editor, you can only use tags that are allowed by Wordpress. Dont think the input tag is one if them.
Look at this:
https://en.support.wordpress.com/code/#html-tags
The "input" tag is not supported by WordPress editor.

Handling submitted forms with python 3

I'm trying to write a quick HTML form:
<!DOCTYPE html>
<html>
<head>
<title>some title</title>
</head>
<body>
<form method="post" action="filename.cgi">
Deploy Process Name:<br>
<input type="text" name="deploy_process_name"><br>
<input type="submit" name="submitXML" value="Submit XML"/>
</form>
</body>
</html>
and I wrote the following script in python using cgi package to extract the data from the form and handle it:
For example - Getting the deploy_process_name
import cgi
def htmlTop():
print("""Content-type:text/html\n\n
<!DOCTYPE html>
<html lange="en">
<head>
<title>Title</title>
</head>
<body>""")
def htmlTail():
print("""</body>
</html>""")
def getData():
formData = cgi.FieldStorage()
deploy_pro_name= formData.getvalue("deploy_process_name")
return deploy_pro_name
if __name__ == '__main__':
try:
htmlTop()
depl= getData()
print("DeployProcessName= {}".format(depl))
htmlTail()
except:
cgi.print_exception()
When I click submit, it just downloads the filename.cgi.
How do I make it run the following script once hitting submit?
It seems you have incorrectly set up server end.
Please follow whatever you're server side CGI is served with to the letter (be it apache httpd, nginx, lighttpd, or whatever)
Things to focus on:
ownership (user:group) of the scripts folder
permissions of the scripts folder
ownership (user:group) of the script
permissions of the script
you seem to have used default extension, but did you ensure the CGI module is loaded and is using that extension to handle CGI?

v14.0 Web Report Viewer Control not displaying body of report

I am hoping someone has an idea about what I am experiencing.
I've worked with various versions of the Report Viewer control (both WinForms and Web) over the years and have just started trying to use the latest HTML5 based version in an ASP .NET Wed Forms project.
My environment is as follows:
Dev laptop with Windows 7 and SQL Server 2014 Including SSRS.
Various remote servers with 2008R2, 2014 and 2016 Reporting Services on them.
I've followed this tutorial page from the Microsoft Docs:
https://learn.microsoft.com/en-us/sql/reporting-services/application-integration/using-the-webforms-reportviewer-control, and have set up a page that points at remote server reports.
Code Behind:
protected void Page_Init(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
rv14.ProcessingMode = ProcessingMode.Remote;
ServerReport serverReport = rv14.ServerReport;
// A 2016 Report
serverReport.ReportServerUrl = new Uri("http://2016server/reportserver");
serverReport.ReportPath = "/Sports";
// A 2014 Report
// serverReport.ReportServerUrl = new Uri("http://2014server/reportserver");
// serverReport.ReportPath = "/SQL2014DemoReports/VertBar";
// A 2008R2 Report
// serverReport.ReportServerUrl = new Uri("http://2008R2server/Reportserver");
// serverReport.ReportPath = "/DemoReports/VertBar";
}
}
ASPX
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Reports.aspx.cs" Inherits="WebNew.Reports" %>
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Reports</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="rv14" runat="server" Width="100%" Height="100%"></rsweb:ReportViewer>
</form>
</body>
</html>
When I run the page, the new HTML based toolbar renders and I get and I get the "loading" mini dialog showing, but then nothing. No report body rendered. The report currently uncommented in the code is a simple list of sports a couple of pages long, nothing complex.
I can tell that the server was contacted and replied as I am seeing the pagination control indicating that there is more than one page, and if I then use any of the export controls, such as PDF, the PDF DOES have the correct rendered output in it.
It is simply not showing in my web page.
I've tried IE (11), Chrome (58) and Firefox (49) and all display the same behaviour. It does not matter which of the servers I target or if I connect to my local instance.
Has anyone seen this behaviour, have any pointers to what might be happening, or a good way of trying to debug?
Many thanks
OK, so I stumbled across a solution to what I was seeing. It would seem that the problem is to do with what the viewer is contained within.
If I wrap the viewer in a DIV and set it's height to 100 vertical height then the viewer does correctly show its content. Previously it must have effectively been in a container of height zero.
Working ASPX code looks like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>2016 Report Viewer Test</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="height:100vh">
<rsweb:ReportViewer
ID="rv14"
runat="server"
Width="100%"
Height="100%">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
Hope this helps someone one day. :-)
Add this, worked for me.
rv14.SizeToReportContent = true;

Why is the file upload ignoreing the language setting?

I have an English and German site, where the user can switch from English to German. When the user switches the site, the content is translated, the language information is set (lang="en", lang="de") but file upload (<input type="file">) is in German. Is there a way to translate it without customizing the file upload?
Example (egnlish):
<html lang="en" xml:lang="en">
<head>
<title>Internationalisation test</title>
</head>
<body>
<form>
<input type="file" name="test">
</form>
</body>
</html>
Example (german):
<html lang="de" xml:lang="de">
<head>
<title>Internationalisation test</title>
</head>
<body>
<form>
<input type="file" name="test">
</form>
</body>
</html>
The file input button's caption is not in German per se, but in web browser's language. Should you use a web browser with different language pack or install it on different OS language, the language would be different.
Is there any way to fix this?
Yes and no.
I'll start with no. If you want to stick to standard HTML control <input type="file"> there is no way to translate the caption.
What you can do though, is to replace the control with non-standard one (usually people tend to use flash-based file upload controls), or... The other way is to actually hide the control (setting z-axis) and put your own text box and a button over it.
That's basically it.