What is the proper method for coding and then receiving NOT exception messages in an ASP.NET web application?
I am using a business object layer which includes a validation method
public bool ValidateData(IList<string> errs)
error messages are added to the collection as strings formatted from program constant templates (globalization is clearly not an issue) eg. "{0} cannot be empty, please enter a value for {0}", where {0} is the field name
the same business layer works for web and desktop applications
EDIT: The collection of error messages is passed back to winform on the error message line or to the web form on the error message label. (no javascript required)
I also used a variant of this that accepts an IDictionary where the first line is the field name and the second line is the error message and a helper function finds the form element bound to the named field to highlight
in general, I use roughly the same pattern in most application systems, depending on the client's needs
source to share