开发者

How to close a webform IN C# LANGUAGE?

开发者 https://www.devze.com 2023-02-03 01:34 出处:网络
I simply want to close an aspx Web Form (that is to sa开发者_StackOverflowy to CLOSE THE CORRENT WINDOW).

I simply want to close an aspx Web Form (that is to sa开发者_StackOverflowy to CLOSE THE CORRENT WINDOW).

I saw a lot of explanations that use a Response.Write with Javascript code, but I will not use

them, because I want to know if the C# language offer the possibility itself to close a Web

Form.

QUESTION: How can I close a Web Form with C# code?


That's not possible. C# runs on your server, JavaScript on your client. So the only suitable solution (I'm aware of) is to send a JavaScript close to the client.


Your C# runs only on the server. It spits out HTML (and maybe JavaScript), then it's done. There's no way to close a window without JavaScript. At most, you might find a C# method that outputs the window.close JavaScript for you. That doesn't buy you much, though.


You can't.

C# is used as a server programming language in ASP.NET

C# runs on the web server that has nothing to do with your browser. To close the browser window you should use a clientside language like javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消