Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 26th, 2005, 06:37 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Spaces getting stripped automatically

I use the following code as a client for sending trackbacks to other blogs. When I use the same script for sending trackbacks to my own website, what happens is that all the spaces get stripped. It can be seen in the first entry here: http://www.drumster.com/trackback.asp?var=154

Now this does not happen when I send trackbacks to other peoples blogs, it gets registered fine.

The script that recieves the trackback ping also recieves the trackbacks fine from other websites, so even that does not have a problem. For reference I am pasting the script of the trackback reciever which recieves the pings.

This is the client code:
Code:
<%@ Language=VBScript %>
<%
Option Explicit

Dim strTitle, strURL, strExcerpt, strBlogName, objHTTP, strTrackBackURL

strTitle = Request.Form("title")
strExcerpt = Request.Form("excerpt")
strURL = Request.Form("url")
strBlogName = Request.Form("blog_name")
strTrackBackURL = Request.Form("trackbackurl")

'// Check if this form has been submitted or not
If IsEmpty(strURL) Then
    '// Nope, show the form
    %>
    <html>
    <head><title>TrackBack Client Example</title></head><body>

    <h2>TrackBack Client Example</h2>
    <form method="POST" action="client.asp">
    TrackBack URL: <input type="text" name="trackbackurl"><br /><br />

    Title: <input type="text" name="title"><br />
    Excerpt: <input type="text" name="excerpt"><br />
    URL*: <input type="text" name="url"><br />
    Site/Blog Name: <input type="text" name="blog_name"><br />
    <input type="submit" name="submit" value="Send TrackBack!">
    </form>

    </body></html>    
    <%    
Else
    '// Send TrackBack:

    '// Create object
    Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

    '// Send TrackBack
    objHTTP.Open "POST", strTrackBackURL, false
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.Send ("title=" & strTitle & "&excerpt=" & strExcerpt & "&url=" & strURL & "&blog_name=" & strBlogName)

    '// Check if it was successful or not
    If InStr(1, objHTTP.responseText, "<error>0</error>") Then
        '// Success!
        Response.Write "Your TrackBack has been sent successfully!"
    Else
        '// Failure
        Response.Write "Your TrackBack has <strong>FAILED</strong>"
    End If

    '// Destroy object
    Set objHTTP = Nothing
End If
%>
This is the code for the script that recieves the pings
Code:
<%
Dim strTitle, strURL, strExcerpt, strBlogName, strBlogID

strTitle = Request("title")
strExcerpt = Request("excerpt")
strURL = Request("url")
strBlogName = Request("blog_name")
strBlogID = Request("var")

'// Set Content-Type
Response.ContentType = "text/xml"

'// Check if there is a url or not
If IsEmpty(strURL) Then
    '// No url, return error
    Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
    Response.Write "<response>"
    Response.Write "<error>1</error>"
    Response.Write "<message>No URL included in TrackBack</message>"
    Response.Write "</response>"
    Response.End
End If

'Everything else is optional, so no need to check that, so display success
Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
Response.Write "<response>"
Response.Write "<error>0</error>"
Response.Write "</response>"

'Now you can do anything you want with the data.
Dim DB, RS,RS2,inuse
Set DB=Connect(trackMDB)
Set RS= Server.CreateObject("ADODB.Recordset")
RS.open "SELECT * FROM trackbacks",DB,adOpenStatic,adLockPessimistic
RS.addnew
RS("Title") = strTitle
RS("Excerpt") = strExcerpt
RS("url") = strURL
RS("blogname") = strBlogName
RS("blogid") = Request("var")
RS.update
Set RS2= Server.CreateObject("ADODB.Recordset")
RS2.open "SELECT * FROM total where blogid=" & Request("var"),DB,adOpenStatic,adLockPessimistic
if (RS2.bof or RS2.eof) then
    RS2.addnew
    RS2("blogid") = Request("var")
    RS2("total") = 1
    RS2.update
else
    RS2("total") = RS2("total") + 1
    RS2.update
end if

'so you can later display it again.
%>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spaces XP Programmer911 General .NET 1 December 19th, 2007 07:03 AM
Diference between these two name spaces pradeepn XSLT 1 June 25th, 2007 02:31 AM
Frame Spaces EvilGuyWhoEatsBrains HTML Code Clinic 2 January 5th, 2005 12:24 PM
spaces problem mateenmohd SQL Server 2000 8 August 11th, 2003 06:27 PM



All times are GMT -4. The time now is 01:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.