[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP/Perl website FSO method fails to locate file since migrating from Win2k server to shared hosting

Posted on 2014-07-10
5
Medium Priority
?
363 Views
Last Modified: 2014-07-11
Since migrating from windows 2000 to shared windows hosting environment failed website functioning. Is it permissions or the code that needs to change. Unfortunately if it is permissions I have no control because this is a shared hosting environment.  If the code is the problem what can I replace it with?  

The code that fails without error - i have been able to determine the  fso.FileExists( SaleRecord ) = False but can't determine why.  Code follows:

'open the text file
	' Instantiate a FileSystem Object
      Set fso = CreateObject( "Scripting.FileSystemObject" )

      ' SaleRecord path must be modified to reflect the file 
      ' structure of the server
      SaleRecord = "C:\inetpub\wwwroot\DWeb\SaleItems\" & _
                  "sales.txt"

      ' Check if the file exists, if not create it
      If fso.FileExists( SaleRecord ) = True Then

      ' Open the SaleRecord and create the entry 
        Set tso = fso.OpenTextFile( SaleRecord, 1, false )
with Response
			line = tso.readline            'strip header line
			while not tso.AtEndOfStream
				line = trim(tso.readLine)
				line = right(line,len(line)-1)
				for i = 0 to 6
					pos = Instr(line,"@")
					items(i) = left(line,pos-1)
					line = right(line, len(line) -(pos+2))
				next
				 items(7) = left(line,len(line)-1)
				.Write tr 
				for i = 0 to 7
					.Write td & items(i) & tdend
				next
				.Write trend
			wend
		 end with
		 
        Call tso.Close()
        set tso = nothing  
	  end if   'file exist   
	  set fso = nothing

Open in new window

0
Comment
Question by:rivarama
5 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40189538
Shared hosting is not usually at "C:\inetpub\wwwroot\".  You have to find the actual path your shared hosting uses to get to your site.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40189599
>   ' Check if the file exists, if not create it

You are also going to need to change the permissions on the folder where you are accessing this in order to create or delete files.  The iuser needs write permissions.

If you have issues with your hosting, try another.   I used to use newtek. http://webservices.thesba.com/legacy-webcontrolcenter-plans/   Their legacy plans have full support for classic asp and you can easily change permissions to folders.
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 40189602
try changing

SaleRecord = "C:\inetpub\wwwroot\DWeb\SaleItems\sales.txt"

to

SaleRecord = Server.MapPath("/SaleItems/sales.txt")

this assumes there's a folder off your root called SalesItems. The Server.MapPath function will translate the virtual path to the physical path, so assuming the file exists, that should work.
0
 

Author Comment

by:rivarama
ID: 40190815
RE: Path:  I posted the original code for simplicity.  

Monty, The command worked perfectly!  Thanks so much!
0
 

Author Closing Comment

by:rivarama
ID: 40190823
Learning ASP on the fly!  Thanks for a simple solution. :)
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question