Comments (3)
I'm not sure I understand what your expected behaviour is here. The error controller isn't intended to be invoked directly via the default route. It replaces the original response as per the settings in the web.config.
The example links on the index don't refer to the error controller by its route, but instead simulate actual error conditions in your application (by raising an exception for 500, setting a status code for 403, and not existing at all for 404).
If for some reason you want to be able to call the the Other action on the Errors controller like "Errors/Other/400" then sure you'll need to either rename the parameter, or alter the routes - but that's not really the purpose of this demo.
As a tangent, if for some reason you do call the error controller directly, then the error replacement configured in the web.config still happens. For example, if you e.g. call http://httperrors-example.azurewebsites.net/Errors/Other/?code=403 - the 403 status code set by the controller gets (correctly) intercepted by IIS and the /Error/Forbidden action is rendered instead.
from asp.net-httperrors-example.
Hi Iain,
Thank you; after reading your response, I find myself in complete agreement and with an even better understanding of how it works--e.g., /Errors/Other/?code=403 > /Error/Forbidden > /Errors/Forbidden.
Looking back, my issue does seem worded rather confusingly--it arises after a day or two of wrestling with two implementation issues:
-
In my case, I had to change web.config path, from path="/Error/Forbidden" to path="/MyAppFolder/Error/Forbidden" (that is, rooted to web site, not web app subfolder)...otherwise I got empty/blank screen content with 403 forbidden or 404 not found errors
-
The above confusion (on my part) about directly accessing controllers
Now I have resolved those issues and wanted to share what worked for me, so others might also use this solution successfully.
I'm grateful. Thank you again.
Kevin
from asp.net-httperrors-example.
Great! Glad you got sorted!
from asp.net-httperrors-example.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asp.net-httperrors-example.