Calling classes from <script>

Joined
Aug 18, 2006
Messages
1
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,098
Messages
2,570,625
Members
47,236
Latest member
EverestNero

Latest Threads

Top