Hey
I´m wondering if its possible to call a class from inside a <script> tag and make a new instance of it in a codebehindfile (it might sound weird as hell but i need to know if it can be done )?
a small portion of the aspx.cs file....
====================================
protected void BtnLogin_Click(Object Sender, EventArgs e)
{
string server = "mail.smtp.net";
if (loadserver.Authorize(txtid, txtpass))
{
lblerr.Text = "user found";
Response.Redirect("access.aspx");
} else {
lblerr.Text = "user not found";
}
Account acc = new Account(); /* i want to call the account class
*/
Session["LoginCount"] = Convert.ToInt32(Session["LoginCount"]) +1;
if (Session["LoginCount"].Equals(maxattempts))
{
lblerr.Text = "number of tries exceeded.";
Response.Redirect("block.aspx", true);
MailMessage mailmsg = new MailMessage("(e-mail address removed)",
"(e-mail address removed)",
"Loginerror",
lblerr.Text.ToString());
SmtpClient mailclient = new SmtpClient(server);
mailclient.Send(mailmsg);
}
===========================================
And the script tag holds the class "account" in the file access.aspx...
===========================================
<script language="C#" runat="server">
namespace FrmLogin
{
public class Account
{
public Account()
{
}
protected void Page_Load(Object Sender, EventArgs e)
{
}
public string GetBalance()
{
return "it works calling classes from <script>";
}
}
}
</script>
=============================================
if it can be done, its great otherwise its not a big deal but it would be good to make it work..
Hopefully someone knows this.
thanks
I´m wondering if its possible to call a class from inside a <script> tag and make a new instance of it in a codebehindfile (it might sound weird as hell but i need to know if it can be done )?
a small portion of the aspx.cs file....
====================================
protected void BtnLogin_Click(Object Sender, EventArgs e)
{
string server = "mail.smtp.net";
if (loadserver.Authorize(txtid, txtpass))
{
lblerr.Text = "user found";
Response.Redirect("access.aspx");
} else {
lblerr.Text = "user not found";
}
Account acc = new Account(); /* i want to call the account class
*/
Session["LoginCount"] = Convert.ToInt32(Session["LoginCount"]) +1;
if (Session["LoginCount"].Equals(maxattempts))
{
lblerr.Text = "number of tries exceeded.";
Response.Redirect("block.aspx", true);
MailMessage mailmsg = new MailMessage("(e-mail address removed)",
"(e-mail address removed)",
"Loginerror",
lblerr.Text.ToString());
SmtpClient mailclient = new SmtpClient(server);
mailclient.Send(mailmsg);
}
===========================================
And the script tag holds the class "account" in the file access.aspx...
===========================================
<script language="C#" runat="server">
namespace FrmLogin
{
public class Account
{
public Account()
{
}
protected void Page_Load(Object Sender, EventArgs e)
{
}
public string GetBalance()
{
return "it works calling classes from <script>";
}
}
}
</script>
=============================================
if it can be done, its great otherwise its not a big deal but it would be good to make it work..
Hopefully someone knows this.
thanks