Unknown Issue - Directory to Database Redirect?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user65
    New Member
    • May 2010
    • 23

    Unknown Issue - Directory to Database Redirect?

    We have an archive server that stores data from 1998-2009, the server had some hard drives fail and I am trying to get everything set back up. It's a bit difficult as the site was setup before I joined the company.

    I was able to get pretty much everything up but what appears to be articles stored within a "/Articles" directory. The new server, including the old hard drives and backup do not contain a physical folder in the root directory called "/Articles."

    Is it possible that there was a redirect setup to point to a specific ID? I'm noticing that each article has two different DB ID's.

    I am sort of lost as I explained earlier I didn't originally set the site up. It appears all content is available except for any articles that had a URL with "/Articles" included.

    Here is an example:
    Works Fine - http://archive.frontpa gemag.com/readArticle.asp x?ARTID=36430

    Broken URL - http://archive.frontpa gemag.com/Articles/ReadArticle.asp ?ID=19145

    The broken URL used to work before the server crashed. And to my knowledge I have restored all databases/website files to the correct locations.

    thanks in advance.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    It appears that this is a web server issue rather than anything specific to SQL Server.

    That may be enough to help you look in the right place for your problem, but if not then let us know what your web server was (is) and whether you had it available as an intranet or extranet (internet hosted outside of your local network) and what software was used for the web service. Also what type of machine / OS it was hosted on. I would assume it is Windows and IIS as you have SQL Server probably running on the same one, but that needs to be confirmed of course.

    When we know this we can move this thread to the relevant forum for the attention of the experts there.

    Comment

    • user65
      New Member
      • May 2010
      • 23

      #3
      Hey NeoPa, thanks for the reply.

      You are correct, I believe this is a web server issue rather than the SQL Server.

      I found that my issue is the global.asax, it simply isn't firing. I have specific redirects setup here but they are not working for some reason.

      From what I've read online you have to re-compile the site with the global.asax when moving it to a server? Is there any other workaround for this? I've tried migrating the redirects to the web.config but I'm having issues.

      I am on a windows server 2003, i believe it's an extranet as it's a dedicated hosted server. IIS is managing the site, I haven't installed visual basic because I didn't feel it necessary.

      Here is the global.asax that is causing my issue:
      Code:
      <%@ Application Language="C#" %>
      
      <script runat="server">
      
          void Application_Start(object sender, EventArgs e) 
          {
              // Code that runs on application startup
      
          }
          
          void Application_End(object sender, EventArgs e) 
          {
              //  Code that runs on application shutdown
      
          }
              
          void Application_Error(object sender, EventArgs e) 
          {
              // Code that runs when an unhandled error occurs
              Exception objErr = Server.GetLastError().GetBaseException();
              string err = "Error in: " + Request.Url.ToString() +
                                ". Error Message:" + objErr.Message.ToString();
              String myUrl = Request.Url.ToString().ToUpper();
      
              if (myUrl.EndsWith("/ARTICLES")) Response.Redirect("/" + Request.QueryString);
              if (myUrl.EndsWith("/BLOG")) Response.Redirect("/listBlogs.aspx" + Request.QueryString);
              if (myUrl.EndsWith("/CONTACT")) Response.Redirect("/contactUs.aspx" + Request.QueryString);
              if (myUrl.EndsWith("/LINKS")) Response.Redirect("/listLinks.aspx" + Request.QueryString);
              if (myUrl.EndsWith("/SEARCH")) Response.Redirect("/search.aspx" + Request.QueryString);
              if (myUrl.EndsWith("/BOOK")) Response.Redirect("/" + Request.QueryString);
      
              if (myUrl.EndsWith("/ARTICLES/AUTHORSLIST.ASPX")) Response.Redirect("/listAuthors.aspx" + Request.QueryString);
              if (myUrl.Contains("/ARTICLES/READ.ASPX?")) Response.Redirect("/readArticle.aspx?" + Request.QueryString);
              if (myUrl.Contains("/ARTICLES/PRINTABLE.ASPX?")) Response.Redirect("/printable.aspx?" + Request.QueryString);
              if (myUrl.Contains("/ARTICLES/AUTHORS.ASPX?")) Response.Redirect("/bioAuthor.aspx?" + Request.QueryString);
              if (myUrl.Contains("/BLOG/READ.ASPX?")) Response.Redirect("/readBlog.aspx?" + Request.QueryString);
              
              Response.Redirect("errorPage.aspx");
      
          }
      
          void Session_Start(object sender, EventArgs e) 
          {
              // Code that runs when a new session is started
      
          }
      
          void Session_End(object sender, EventArgs e) 
          {
              // Code that runs when a session ends. 
              // Note: The Session_End event is raised only when the sessionstate mode
              // is set to InProc in the Web.config file. If session mode is set to StateServer 
              // or SQLServer, the event is not raised.
      
          }
             
      </script>

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        I'm afraid that's pretty well all Greek to me, but I can move this to somewhere they're fluent in such language.

        Good luck.

        Comment

        • user65
          New Member
          • May 2010
          • 23

          #5
          After further research I've learned that it appears to only be asp files, not aspx are affected. So I tested my global.asa and i can get the test to complete per microsoft's suggestions. Although the redirect still isn't working.

          originally the global.asa file had this:
          Code:
                  if (myUrl.Contains("/ARTICLES/READARTICLE.ASP?")) then Response.Redirect("/readArticle.aspx" + Request.QueryString)
                  if (myUrl.Contains("/ARTICLES/PRINTABLE.ASP?")) then Response.Redirect("/printable.aspx?" + Request.QueryString)
                  if (myUrl.Contains("/ARTICLES/AUTHORS.ASP?")) then Response.Redirect("/bioAuthor.aspx?" + Request.QueryString)
                  if (myUrl.Contains("/BLOG/BLOGENTRY.ASP?")) then Response.Redirect("/readBlog.aspx?" + Request.QueryString)
          I changed the global.asa to this:
          Code:
          <script language="vbscript" runat="server">
          
          sub Application_OnStart
          end sub
          
          sub Application_OnEnd
          end sub
          
          sub Session_OnStart
          Session("Test") = Now()
          end sub
          
          sub Session_OnEnd
          end sub
          
          sub Application_OnError
                  if (myUrl.Contains("/ARTICLES/READARTICLE.ASP?")) then Response.Redirect("/readArticle.aspx" + Request.QueryString)
                  if (myUrl.Contains("/ARTICLES/PRINTABLE.ASP?")) then Response.Redirect("/printable.aspx?" + Request.QueryString)
                  if (myUrl.Contains("/ARTICLES/AUTHORS.ASP?")) then Response.Redirect("/bioAuthor.aspx?" + Request.QueryString)
                  if (myUrl.Contains("/BLOG/BLOGENTRY.ASP?")) then Response.Redirect("/readBlog.aspx?" + Request.QueryString)
          Response.Redirect("errorPage.aspx")
          end sub
          </script>
          Still able to get the test.asp to display server date and time, but the redirect just isn't working. So have I successfully determined that the global.asax and global.asa are firing, but for some reason aren't working? Do I need to add a setting somewhere in IIS to enable the custom redirect?

          Thanks in advance

          Comment

          • user65
            New Member
            • May 2010
            • 23

            #6
            The global.asax has to be firing because I am able to successfully use one of the redirects setup within the error handling:



            The global.asax tells this directory to go to listAuthors.asp x

            How come only one out of so many requested redirects are working? Also, it appears to be only working with the correct capitalization on characters. The redirects all include capital letters, but if I don't type it in all caps when requesting the URL it goes into a redirect loop. I added the lowercase version of the above redirect so it works correctly. Shouldn't it automatically work with any combo of capitalization?

            Thanks in advance.

            Comment

            Working...