<p>As you can see this is a question from a non web developer. I would like to have an ASPX page which, under certain circumstances, can generate a 401 error from code. Ideally it would show the IIS standard page.</p>

You should be able to just use the following, according to
MSDN
.
```
```
Throw New HttpException(401, "Auth Failed")
```
```
Edit
After seeing the other responses setting the status code would be more appropriate.