Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 405 ?

Status
Not open for further replies.

iceb

Technical User
Jan 13, 2002
64
DK
Hi

I could not find a asp department or section here so I

used this if anyone knows of an asp section please let me

know....

I have downloaded a component called aspTear which gets the

source code from a url and I chose this one...


Here is the code that retrieves it

<%
Const Request_POST = 1
Const Request_GET = 2

Set xobj = CreateObject(&quot;SOFTWING.ASPtear&quot;)
Response.ContentType = &quot;text/html&quot;

On Error Resume Next
' URL, action, payload, username, password
strRetval = xobj.Retrieve(&quot; Request_POST, &quot;test=wille&quot;, &quot;&quot;, &quot;&quot;)

If Err.Number <> 0 Then
Response.Write &quot;<b>&quot;
If Err.Number >= 400 Then
Response.Write &quot;Server returned error: &quot; & Err.Number
Else
Response.Write &quot;Component/WinInet error: &quot; & Err.Description
End If
Response.Write &quot;</b>&quot;
Response.End
End If

Response.Write strRetval
%>

Here is some info on the component



and here is some on the newest version but that version

is only in shareware and therefor not free.....



The problem is that I cannot be allowed to retrieve most pages

which I have tried. Lycos.dk work though.

How can I get allowed to do this ?

I get the error 405 a lot and here is the specification for it


Hope to hear from you soon.

iceyboo
 
forum333 is the ASP forum for future reference.

I read a little off that page, and it said something about userName and password required for some sites. I'm guessing that's your problem.

After all, ASP source code is not going to just come down the pipe as its original source. If that's the case, we're all in big trouble since sensitive information is in those source files. I would suppose that if you had the proper credentials, then it would let you grab those pages, but if you had those credentials, why would you need the component?

Anyway -- here's hoping you don't get my database security information. ;-)
penny.gif
penny.gif
 
Hm ok as you can see I did not accept your answer.

The problem and the issue is that I want to get

the client-side source code and not the server-side.

This is done with xmlhttp from microsoft but xmlhttp

does not allow for Danish characters in the pages being

retrieved. Example of characters not being retrived are....

æ å ø

Hope you understand this problem now.

I found the asp section .
 
iceb:

I'm not sure I understand exactly what you want to achieve (perhaps you should work more on defining the problem for yourself, so that you can explain it to the rest of the world?), but I would like to point you in the direction of this article from the 4GuysFromRolla.com web site:


It deals with Microsoft's XMLHTTP Object, of which there apparently exists a newer version - perhaps this will deal better with Danish and other non-standard characters?

Also, if you only want to see the HTML and (javascript?) code of specific pages, why don't you use the &quot;view source&quot; feature of your browser? I normally have no problem viewing Swedish non-standard characters in that way...

Before continuing, you might also consider that &quot;tanking&quot; down entire sites consumes unnecessary amounts of bandwidth and bogs down the server you're sending your requests to, and may in some regions be illegal.

DrMaggie

---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
Ok Thx very much it works with the xml

on the site you gave me.

The only problem is that æåø in the source

code is transformed to

&aelig;
&oslash;
&aring;

and then I would like to know if it is

possible to replace these codes above

with æåø and if it is how do I do it ?

Please use examples ok ?

 
iceb:

Glad xml helped.

As for the problem with the Danish characters, I guess you could use a text editor to simply switch the &quot;ø&quot; and &quot;å&quot;?!

I don't know what editors you have on your system, but many allow you to save macros which can do this substitutions automatically after you've programmed it once.

Another, perhaps more elegant, method is to have your ASP code do the substitution for you - if you store the contents of the external site you've called into some string variable, you can for instance use VBScript's Replace function - an example from the VBScript manual:

Dim MyString
MyString = Replace(&quot;XXpXXPXXp&quot;, &quot;p&quot;, &quot;Y&quot;)

This runs a binary comparison starting at the beginning of the string, and returns &quot;XXYXXPXXY&quot;.

(see the VBScript manual at msdn.microsoft.com/library/en-us/script56/html/vtoriVBScript.asp for more detailed info)

No matter which method you chose, my tip would be to first exchange all &quot;å&quot;s with &quot;abc123&quot;s, then the &quot;ø&quot;s to &quot;å&quot;s, and finally all &quot;abc123&quot;s to &quot;ø&quot;s - you need several steps, or you lose some of your original characters! (I'm guessing not too many webpages contain the text strings &quot;abc123&quot;, so it should be safe to use this as an intermediate string...)

Then do the same for the capital letters.

DrMaggie
---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
Well ok the script displays æåø after all.

Now I want to put the source code into a txt file using

a varable.

The code follows which does not work ...

<%
Response.Buffer = True
Dim objXMLHTTP, xml
' Create an xmlhttp object:
Set xml = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)
' Opens the connection to the remote server.
xml.Open &quot;GET&quot;, &quot; False
' Actually Sends the request and returns the data:
xml.Send
'Display the HTML both as HTML and as text

response.write xml.responseText

strTekst=xml.responseText

' Set up Constants
Const ForWriting = 2 ' Input OutPut mode
Const Create = True

' Dimension local variables
Dim MyFile
Dim FSO ' FileSystemObject
Dim TSO ' TextStreamObject

' always use MapPath function to get the Physical Path of file
MyFile = Server.MapPath(&quot;Welcome.txt&quot;)
Set FSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)
TSO.write (strTekst)
' Vbcrlf is next line character
TSO.write &quot;This is Second line in this text file&quot; & vbcrlf
' Now Function will write local time
TSO.write &quot;Writen by devasp visitor at &quot; & Now()
TSO.WriteLine &quot;&quot;

Response.Write &quot; Three lines are writen to textfile.txt <br>&quot;
Response.Write &quot; Local time at server is &quot; & Now()

' close TextStreamObject and
' destroy local variables to relase memory
TSO.close
Set TSO = Nothing
Set FSO = Nothing

Set xml = Nothing
%>
 
iceb:

I'll look at your script later - have to do some work first :)

However, it would be extremely helpful if you could be more specific than just &quot;The code follows which does not work ...&quot; - I mean, what are the error messages you get, at which line number is the execution hanging, etc - or if the code actually works, but the result is unexpected!

Later,
DrMaggie
---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
Serverobject error 'ASP 0177 : 800a0005'

Server.CreateObject was not executed

/getit.asp, line 31

00000000

this is line 31

TSO.write (strTekst)

I translated the above error messages.


 
iceb:

OK, I'm a bit busy, but here goes:

Do you have much experience with working with the FileSystemObjects? I don't do too much stuff with it, but I do remember from last time (in September last year) that it was a bit trickier than I thought to get the syntax right, and then I had some problems with the Write-privilege (I wasn't allowed to write new files).

Why don't you create a simple &quot;test script&quot; in which you only do something simple, like creating the object and then, step by step, opening the file, closing it, writing a simple line, writing more lines, etc...

My point is, that when one tries to do &quot;everything&quot; (i.e. do the XML stuff + the FSO code) at the same time, it is easy to overlook something...

I include at the bottom a very simple FSO script - perhaps it can help you find what is wrong with yours?

DrMaggie

--------------- script excerpt follows -------------
' >> let's define and open the output files here:

' >> declare variables:
dim fs, fx, path, path0, str1, str2, tgtstr, prjstr

' >> let's get the correct path information:
str1 = Request.ServerVariables(&quot;PATH_translated&quot;)
str2 = request.ServerVariables(&quot;SCRIPT_NAME&quot;)
path0 = left(str1,instr(str1,right(str2,(len(str2)-instrrev(str2,&quot;/&quot;))))-1)
path = path0 & &quot;test.txt&quot;

' >> create the FileSystemObject:
Set fs = CreateObject(&quot;Scripting.FilesystemObject&quot;)

' >> create the output file (delete it if it already exists!):
If fs.FileExists(path) = true Then
fs.DeleteFile path
end if
If fs.FileExists(path) = false Then
Set fx = fs.CreateTextFile(path, True)
' *>> uncomment for debugging!
' response.Write &quot;Output file &quot; & path & &quot; has been created!<br>&quot;
end if

' >> here the writing to the file starts...
fx.WriteLine &quot;this is a test!&quot;

' >> now close the output table file:
fx.Close
----------------- script excerpt ends --------------

---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
Hi this is as close as I can get to the

soiution.

The text between the &quot; &quot; is printed to

the file Welcome.txt now I need to know

how to replace the text with the

xmlresponseText

so the source code will be printed to the

text file and here I guess I can use a

variable ?


<%
Response.Buffer = True
Dim objXMLHTTP, xml
' Create an xmlhttp object:
Set xml = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)
' Opens the connection to the remote server.
xml.Open &quot;GET&quot;, &quot; False
' Actually Sends the request and returns the data:
xml.Send
'Display the HTML both as HTML and as text

response.write xml.responseText

Set xml = Nothing

strTekst=&quot;here_I_want_the_variable&quot;

' Set up Constants
Const ForWriting = 2 ' Input OutPut mode
Const Create = True

' Dimension local variables
Dim MyFile
Dim FSO ' FileSystemObject
Dim TSO ' TextStreamObject

' always use MapPath function to get the Physical Path of file
MyFile = Server.MapPath(&quot;Welcome.txt&quot;)
Set FSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)
TSO.write (strTekst)

TSO.close
Set TSO = Nothing
Set FSO = Nothing


%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top