コード例 #1
0
    private void LoadWebAuthForm()
    {
        //Be sure the eService token is in the web.config under appSettings with a key named WebAuthToken
        //<appSettings>
        //    <add key="WebAuthToken" value="xxxxxxxxxxxxxxxxxxxx"/>
        //</appSettings>

        // Instantiate the the WebAuthProcess class
        WebAuthProcess wap = new WebAuthProcess();

        //Set the return into the login_form div
        divLoginForm.InnerHtml = wap.ReturnLoginForm(this.Session.SessionID, "");
    }
コード例 #2
0
    private void GetAuthProcessResult()
    {
        // if no user session
        if (Session["Ename"] == null)
        {
            // Instantiate the the process result return value object
            WebAuthReturnValues war = new WebAuthReturnValues();

            // Instantiate the the WebAuthProcess class
            WebAuthProcess wap = new WebAuthProcess();

            //Load the AuthProcessReult into the local instance of WebAuthReturnValues
            war = wap.AuthProcessResult("Default.aspx");

            //Is the authentication attempt successful?
            if (war.successfulAuthentication != true)
            {
                divAuthProResult.InnerHtml = war.html;
                return;
            }

            // get Ename and CSUID from WebAuth
            Session["Ename"] = war.eName;
            Session["CSUID"] = war.CSUID;
        }

        // get person details from WEID table using Ename
        if (!getPersonDetails())
        {
            divAuthProResult.InnerHtml = "Sorry, you are not authorized to request this item. You must be a current CSU student, faculty or staff member.";
            return;
        }

        // TODO: move these checks to Default.aspx.cs since they shouldn't require login?

        // assure that there is a referring URL from a catalog item
        if (Session["ReferringURL"] == "")
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item: No referring URL.";
            return;
        }

        // assure that there is a bib number
        string bibNumber = Session["BibNumber"].ToString();
        if (bibNumber == "")
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item: No bibliographic number was found in the referring or link URL.";
            return;
        }

        // get item information from solr record
        if (!getItemDetails(bibNumber))
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item with bib number " + bibNumber + " in Discovery.";
            return;
        }

        // get Prospector availability
        // TODO: report Prospector is unavailable for checking, if necessary
        //getRegionalAvailability(bibNumber);
        // get first 13-digit ISBN, if any (otherwise use 10-digit ISBN which is the older format)
        string isbn = "";
        string[] isbns = getSessionParam("ISBN").Split(new string[] { "<br />" }, StringSplitOptions.None);
        foreach (string i in isbns)
            if (isbn.Length < 13 && i.Length >= 10) isbn = Regex.Replace(i, @"[^0-9]", "");

        // Send to Prospector information or directly to request form
        Session["ProspectorCopies"] = 0;
        Session["ProspectorAvailable"] = 0;
        Session["ProspectorURL"] = "";
        Session["ProspectorRequest"] = "";
        if (isbn != "" && getRegionalAvailability(isbn) && !Session["ProspectorAvailable"].ToString().Equals("0"))
            Response.Redirect("~/Prospector.aspx");
        else {
            Response.Redirect("~/Order.aspx");
        }
    }
コード例 #3
0
    private void GetAuthProcessResult()
    {
        // if no user session
        if (Session["Ename"] == null)
        {
            // Instantiate the the process result return value object
            WebAuthReturnValues war = new WebAuthReturnValues();

            // Instantiate the the WebAuthProcess class
            WebAuthProcess wap = new WebAuthProcess();

            //Load the AuthProcessReult into the local instance of WebAuthReturnValues
            war = wap.AuthProcessResult("Default.aspx");

            //Is the authentication attempt successful?
            if (war.successfulAuthentication != true)
            {
                divAuthProResult.InnerHtml = war.html;
                return;
            }

            // get Ename and CSUID from WebAuth
            Session["Ename"] = war.eName;
            Session["CSUID"] = war.CSUID;
        }

        // get person details from WEID table using Ename
        if (!getPersonDetails())
        {
            divAuthProResult.InnerHtml = "Sorry, you are not authorized to request this item. You must be a current CSU student, faculty or staff member.";
            return;
        }

        // TODO: move these checks to Default.aspx.cs since they shouldn't require login?

        // assure that there is a referring URL from a catalog item
        if (Session["ReferringURL"] == "")
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item: No referring URL.";
            return;
        }

        // assure that there is a bib number
        string bibNumber = Session["BibNumber"].ToString();

        if (bibNumber == "")
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item: No bibliographic number was found in the referring or link URL.";
            return;
        }

        // get item information from solr record
        if (!getItemDetails(bibNumber))
        {
            divAuthProResult.InnerHtml = "Cannot find the requested item with bib number " + bibNumber + " in Discovery.";
            return;
        }

        // get Prospector availability
        // TODO: report Prospector is unavailable for checking, if necessary
        //getRegionalAvailability(bibNumber);
        // get first 13-digit ISBN, if any (otherwise use 10-digit ISBN which is the older format)
        string isbn = "";

        string[] isbns = getSessionParam("ISBN").Split(new string[] { "<br />" }, StringSplitOptions.None);
        foreach (string i in isbns)
        {
            if (isbn.Length < 13 && i.Length >= 10)
            {
                isbn = Regex.Replace(i, @"[^0-9]", "");
            }
        }

        // Send to Prospector information or directly to request form
        Session["ProspectorCopies"]    = 0;
        Session["ProspectorAvailable"] = 0;
        Session["ProspectorURL"]       = "";
        Session["ProspectorRequest"]   = "";
        if (isbn != "" && getRegionalAvailability(isbn) && !Session["ProspectorAvailable"].ToString().Equals("0"))
        {
            Response.Redirect("~/Prospector.aspx");
        }
        else
        {
            Response.Redirect("~/Order.aspx");
        }
    }