locked
upgrading website code from ASP 2.0 RRS feed

  • Question

  • User-1823120867 posted

    I manage a website for a nonprofit that was built with ASP code.  It is currently hosted on a private server running an older version of NT.  I plan to migrate the site to a larger hosting service that will support newer versions of .NET, and will be redesigning the site to use .NET 3.5.

    The site uses .ain include files called from .asp files to connect to Excel spreadsheets and dynamically build HTML using a SQL statement.  The include file connects to the spreadsheet using a direct pathname.  Obviously, this direct path will not work when the site is migrated to a new hosting service, but the code does not work with a relative pathname.

    Could you recommend a way to update the code so it will function when the website is moved?

    The code used to access the Excel spreadsheets is:

    set dbConn = server.createobject("adodb.connection")

    dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _

    "Data Source=D:\(pathname)" & db & ".xls;" & _

    "Extended Properties=""Excel 8.0;"""

    set dbrs = server.createobject("adodb.recordset")

    dbrs.open statement, dbConn

    where "db" is a variable specifying the name of the spreadsheet to use, and statement is a SQL query.

    (Apologies if this should be posted to an older ASP language forum- if so, please let me know what is appropriate.)

    Thanks, Amanda

     

    Tuesday, December 23, 2008 10:42 AM

Answers

  • User-504499122 posted

    If I understand your issue properly.. You can take the relative or virtual path and convert into physical path using the following function.. and that should do it

      
    String FilePath;
    FilePath = Server.MapPath("/MyWebSite");
    
     
    http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 23, 2008 11:15 AM

All replies

  • User-504499122 posted

    If I understand your issue properly.. You can take the relative or virtual path and convert into physical path using the following function.. and that should do it

      
    String FilePath;
    FilePath = Server.MapPath("/MyWebSite");
    
     
    http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 23, 2008 11:15 AM
  • User-1823120867 posted

    Thanks Kumar, that worked nicely.  - Amanda

    Sunday, December 28, 2008 4:14 PM