Megha Jain
Megha Jain

Reputation: 1887

close Browser from code behind - aspx

I have this aspx page and it works all fine.

protected void Page_Load(object sender, EventArgs e)
{
   string clientID = Request.QueryString["ID"];
   string clientName = Request.QueryString["NAME"];
   folderSearch(clientID, clientName);
}
public void folderSearch(string clientID, string clientName)
{
    SYS.getInfo(searchDBInfo => 
   {
        string folderPath = searchDBInfo.sPath + "\\" + clientID + " - " + clientName;
        if (Directory.Exists(folderPath))
        {
            Process.Start(folderPath);
        }
        else
        {
           Directory.CreateDirectory(folderPath);
           Process.Start(folderPath);
        }
   });
}

I would like the aspx running browser window to be closed straight after it displayed. means user should not be able to see any browser running but it can still do its job in background.

Please help me guys! Thanks.

Upvotes: 0

Views: 401

Answers (2)

user1409909
user1409909

Reputation:

The only solution to do this is by Javascript (client side) with window.close() and you'll have a prompt showing you "Do you want to close this window" .

One solution would be to "close" after display is to redirect after a sleep and you'll not have the prompt.

Note : The page won't show up if your server-side code is not finished.

Upvotes: 0

Habib
Habib

Reputation: 223422

I would like the aspx running browser window to be closed straight after it displayed. means user should not be able to see any browser running but it can still do its job in background.

It is not in your control, it is a browser function, and you can't do anything about it.

Upvotes: 2

Related Questions