[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] // all exceptions caught and written to server event log
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                CheckPlayAssignment();
                SlkUtilities.RetryOnDeadlock(delegate()
                {
                    Response.Clear();
                    ClearError();

                    m_framesetHelper = new FramesetHelper();
                    m_framesetHelper.ProcessPageLoad(SlkStore.PackageStore, TryGetSessionView, TryGetAttemptId, ProcessViewRequest);

                    // If this is not e-learning content, then we have to write the content directly to response.
                    if (!HasError && !m_isELearning)
                    {
                        SendNonElearningContent();
                        Response.End();
                    }
                });
            }
            catch (ThreadAbortException)
            {
                // response ended. Do nothing.
                return;
            }
            catch (FileNotFoundException)
            {
                Response.StatusCode        = 404;
                Response.StatusDescription = "Not Found";

                RegisterError(SlkFrameset.FRM_DocumentNotFoundTitleHtml, SlkFrameset.FRM_DocumentNotFound, false);
            }
            catch (UserNotFoundException)
            {
                Response.StatusCode        = 500;
                Response.StatusDescription = "Internal Server Error";

                // This probably indicates the site allows anonymous access and the user is not signed in.
                RegisterError(SlkFrameset.FRM_AssignmentNotAvailableTitle, SlkFrameset.FRM_SignInRequiredMsgHtml, false);
            }
            catch (HttpException ex)
            {
                // Do not set response codes

                SlkStore.LogException(ex);
                RegisterError(SlkFrameset.FRM_AssignmentNotAvailableTitle, SlkFrameset.FRM_AssignmentNotAvailableMsgHtml, false);
            }
            catch (Exception ex)
            {
                Response.StatusCode        = 500;
                Response.StatusDescription = "Internal Server Error";

                SlkStore.LogException(ex);
                RegisterError(SlkFrameset.FRM_AssignmentNotAvailableTitle, SlkFrameset.FRM_AssignmentNotAvailableMsgHtml, false);
            }
        }
Пример #2
0
 public bool ProcessAttemptIdParameter(bool showErrorPage, out AttemptItemIdentifier attemptId)
 {
     return(FramesetHelper.TryProcessAttemptIdParameter(showErrorPage, out attemptId));
 }
Пример #3
0
 /// <summary>
 /// Returns true, and the value of the required parameter. If the parameter is not found or has no value,
 /// this method will display the error page.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="value">The value of the parameter. The value should be ignored if false is returned.</param>
 /// <returns>True if the parameter existed.</returns>
 public bool TryGetRequiredParameter(string name, out string value)
 {
     return(FramesetHelper.TryGetRequiredParameter(name, out value));
 }
Пример #4
0
 /// <summary>
 /// Clears the current error state.
 /// </summary>
 protected virtual void ClearError()
 {
     FramesetHelper.ClearError();
 }
Пример #5
0
 /// <summary>
 /// Register error information to be written to the response object.
 /// Only the first error that is registered is displayed.
 /// </summary>
 /// <param name="shortDescription">A short description (sort of a title) of the problem. Html format.</param>
 /// <param name="message">A longer description of the problem. Html format.</param>
 /// <param name="asInfo">If true, message is show with Info icon. Otherwise, it's an error.</param>
 protected virtual void RegisterError(string shortDescription, string message, bool asInfo)
 {
     FramesetHelper.RegisterError(shortDescription, message, asInfo);
 }