This is a migrated thread and some comments may be shown as answers.

FileSystemContentProvider error handling

1 Answer 31 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sajid
Top achievements
Rank 1
Sajid asked on 26 Jul 2010, 01:06 AM
Hi,

I have used FileSystemContentProvider to implement custom logic for image uploading and it works fine. The problem is if there is an error I want to be able to notify user. Is there a good way of doing this?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Sajid
Top achievements
Rank 1
answered on 26 Jul 2010, 02:28 AM
Never mind I figured out how to display error. It isn't pretty but it works.

private void showErrorMessage(string errorMessage)
        {
            StringBuilder errorBuilder = new StringBuilder();
            errorBuilder.Append("<script language='javascript'>alert('");
            errorBuilder.Append(errorMessage);
            errorBuilder.Append("');</script>");
 
            HttpContext.Current.Response.Write(errorBuilder.ToString());
        }

In this way if error occurs during custom logic user will get alert box explaining what the problem is.
Tags
Editor
Asked by
Sajid
Top achievements
Rank 1
Answers by
Sajid
Top achievements
Rank 1
Share this question
or