End and Application.Exit are pretty serious calls from the sequrity
point of view because they terminate the whole application (vs. just one
app domain). In a case when multiple apps running in the same host, such
call will try to terminate _all_ apps and therefore these calls require
additional priveleges that are not granted when code runs in semi-trusted
environment. When you run code from a website the code is running in such
secure environment and that's why you get permission errors.
If your app is a singlethreaded app (you do not start additional
threads), in order to exit your code just needs to return from your Main
function. That would be most correct and graceful termination. An unhandled
exception will do this too, but this is somewhat less gracefull, brute
force way to do the same. In multithreaded case all threads should exit.
Vladimir [VB.Net team]
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Ricky" <
[email protected]>
| Sender: "Ricky" <
[email protected]>
| Subject: Ending a program
| Date: Mon, 15 Sep 2003 09:34:33 -0700
| Lines: 6
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN7pz5WTNw9bzxJQ7GjD4hnBqhz4A==
| Newsgroups: microsoft.public.dotnet.languages.vb
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:137053
| NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I'm trying to run a program directly from the web.
| It's working perfectly, but a simple "End" statement
| or "Application.Exit" do not work for me and I get
| permission errors.
|
| How can I end a program when running from the web ?
|