In general, I've found that re-writing code tends to be trouble (it is expensive, time-consuming, and involves a discovery phase that makes the first system look better).
That said, here are a few questions to ask:
Would core refactoring suffice? You'll know from evaluating the system whether or not the central issues go deeper than the code. If the issues are in the code base (rather than the technology itself), I prefer refactoring.
To what extent is the current system testable? Testability goes a long way toward extending the service life of any system module because testable code generally lends itself more readily to extension and maintainability. This relates to #1 as well.
Lastly, would the value provided from a re-write justify the effort. This is a business question, certainly, but one that the developer can and should help make.
In most cases I've encountered, the answer was no.