difference between HttpException and other Exceptions [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
i can't figure out what is difference between HttpException and other exceptions in asp mvc,
based on asp helper HttpException means Describes an exception that occurred during the processing of HTTP requests.
it says during the processing of HTTP requests in that case does not other exceptions occurr during HTTP requests?

The processing of a HTTP request can raise other exceptions - it depends on what methods you are calling.
For example a BinaryRead() raises an ArgmentOutOfRangeException.
You need to look at the exceptions raised by each method and decide whether you can sensibly trap them or whether you have to let them propagate.

Related

How to avoid Cross Site Cross-Site Request Forgery for GET Request [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How to avoid Cross-Site Request Forgery for GET method. I have used AntiForgeryToken for all POST methods in my MVC application. Even though it is not needed for Get request, but I want to know the solution to prevent CSRF for HttpGet methods.
Please refer below post. You actually don't need anti-forgery for get request.
https://security.stackexchange.com/questions/115794/should-i-use-csrf-protection-for-get-requests

what exceptions to handle when configuring retry for mass transit [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
When configuring UseScheduledRedelivery in a mass-transit consumer. what is the best practice for what should be handled.
Is handling Exception overkill? and is there a list of exceptions that can proberbly be recovered from?
Redelivery is second-level retry. It means that it handles exceptions that are not recovered by first-level retry (retry policies).
Basically, you probably want to retry everything except exceptions that are caused by your message data. However, even null reference exceptions can be subject of retries. For example, you have a database and you try to get a record and get null. This can be because the record is not there yet, but it will come later since there is a message in the queue to create it. So, race conditions can lead to such exceptions.
Second-level retries, however, are different. You want to use them to overcome, for example, issues with resource starvation (busy database or something). These exceptions are very specific, like network timeout exception or database timeout exception. But there is no "list", you need to look at your system design to decide where you apply first-level retries and where you use second-level retries, and which exceptions are handled by those.
We use retries for all exceptions and redelivery for a very small number of exceptions and not in all services. Usually we redeliver after getting database timeout.

Limiting controllers to specific request method [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
From a security perspective. What is the worst that can happen when you have a controller that is wide open. What I mean by this is that you can call this controller using a post, get, put, delete, update, trace etc.
I guess you are talking about a controller that's not decorated with [Authorize] attribute.
What is worst that can happen, depends on how you look at it. Suppose your controller has a get method, which exposes some privacy related information. That means this sensitive information is available for anyone who is on the internet.
Similarly if you have a post method to delete some information, anyone on the internet will be able to call the delete method.

Return exception with original request object [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there a way to return a custom exception along with the requested object? We are creating .NET object representations of a Vendor's API and the closest match to doing what they do would be to throw an exception along with the requested data/object.
There are many ways to do this without exceptions, but I'm curious to see if anyone has done this before.
Well just create a custom exception object as described here:
http://msdn.microsoft.com/en-us/library/87cdya3t(v=vs.110).aspx
And add one property holding your requested object or the parameters or whatever and throw your custom exception...

capture exceptions and write to log [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to set up something for logging that will capture any exception or such that my projects might run into that I haven't been able to anticipate with say a try{} catch{}.
The project I'm working on has too many possible places where something can happen, and I need to be able to capture those instances and write them out to a log that I can read and be made aware of problems.
I've seen references to log4net, but I'm not familiar enough with it to know if it can log any uncaught exceptions, or other errors.
Thank you.
Use ELMAH for logging your errors, follow this link as to implement it in winforms.

Categories