client side code:

<script type="text/javascript" language="javascript">
function closeMe()
 {
            // Code is here

}
</script>

server side .cs file code

protected void btnlogin_Click(object sender, EventArgs e)
{
if (checkuser(UserName.Text, Password.Text))
{
// i want to call closeMe() function here.
}
else
{

}

}

Hi,

I would not do it that way, you are taking a round trip to the server to check if something has been filled in then trying to close the browser window if it hasn't?

Or is it a security feature? In which case, if they haven't logged in why not simply use Response.redirect to put them onto your login page...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.