http://www.aspnettutorials.com/tutorials/advanced/txt-to-speech-asp4-cs/
aspx page
<%@ Page Language="C#" AutoEventWireup="true" Async="true" CodeBehind="LogInPage.aspx.cs" Inherits="WebApplicationSampleforSound.LogInPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#txtusername").mouseover(function () {
var Name = $("#txtusername").val();
var data = { Name: Name };
$.ajax({
type: "POST",
url: "LogInPage.aspx/UserName",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
$("#txtpwd").mouseover(function () {
var Pwd = $("#txtpwd").val();
var data = { Pwd: Pwd };
$.ajax({
type: "POST",
url: "LogInPage.aspx/Password",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
$("#btnlogin").mouseover(function () {
var Name = $("#txtusername").val();
var Pwd = $("#txtpwd").val();
var data = { Name: Name, Pwd: Pwd };
$.ajax({
type: "POST",
url: "LogInPage.aspx/LogIn",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
UserName:<asp:TextBox ID="txtusername" runat="server"></asp:TextBox><br /><br /><br /><br />
Password:<asp:TextBox ID="txtpwd" runat="server" TextMode="Password"></asp:TextBox><br /><br /><br /><br /><br />
<asp:Button ID="btnlogin" runat="server" Text="LogIn" />
</div>
</form>
</body>
</html>
aspx page
<%@ Page Language="C#" AutoEventWireup="true" Async="true" CodeBehind="LogInPage.aspx.cs" Inherits="WebApplicationSampleforSound.LogInPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#txtusername").mouseover(function () {
var Name = $("#txtusername").val();
var data = { Name: Name };
$.ajax({
type: "POST",
url: "LogInPage.aspx/UserName",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
$("#txtpwd").mouseover(function () {
var Pwd = $("#txtpwd").val();
var data = { Pwd: Pwd };
$.ajax({
type: "POST",
url: "LogInPage.aspx/Password",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
$("#btnlogin").mouseover(function () {
var Name = $("#txtusername").val();
var Pwd = $("#txtpwd").val();
var data = { Name: Name, Pwd: Pwd };
$.ajax({
type: "POST",
url: "LogInPage.aspx/LogIn",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
datatype: "json",
async: "true",
success: function (result) {
}
//error: function (result) {
// alert(this.exception);
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
UserName:<asp:TextBox ID="txtusername" runat="server"></asp:TextBox><br /><br /><br /><br />
Password:<asp:TextBox ID="txtpwd" runat="server" TextMode="Password"></asp:TextBox><br /><br /><br /><br /><br />
<asp:Button ID="btnlogin" runat="server" Text="LogIn" />
</div>
</form>
</body>
</html>
aspx.cs page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Speech.Synthesis;
using System.Threading.Tasks;
using SpeechLib;
using System.Web.Services;
using System.Web.Script.Services;
namespace WebApplicationSampleforSound
{
public partial class LogInPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//SpVoice Voice = new SpVoice();
//Voice.Speak("Welcome to verity information solutions.");
}
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public static string UserName(string Name)
{
try {
SpVoice Voice = new SpVoice();
Voice.Speak("Enter User Name");
}
catch
{ }
return "sucess";
}
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public static string Password(string Pwd)
{
try {
SpVoice Voice = new SpVoice();
Voice.Speak("Enter Password");
}
catch
{ }
return "sucess";
}
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public static string LogIn(string Name, string Pwd)
{
try
{
SpVoice Voice = new SpVoice();
Voice.Speak("Enter Correct UserName and Password");
}
catch
{ }
return "sucess";
}
}
}
No comments:
Post a Comment
Hello all, if you have any doubt feel free comment