以下為本站文章分類清單

  1. AJAXspacer
  2. ASPspacer
  3. CSSspacer
  4. Javascriptspacer
  5. Windows 應用程式spacer
  6. 網頁設計
  7. 評論、短文、雜文spacer
  8. 版主spacer
  9. 最新回應spacer

以下為本頁本文內容

XMLHTTP的ASP使用例:連結網址檢查

AJAX 熱火的不得了,主要由於Mozilla、Opera 等主流瀏覽器都支援了 XMLHttpRequest 物件,這個微軟在 IE 5.0 推出 ActiveX 時就存在的物件,名為 XMLHTTP,只不過只有 IE 瀏覽器支援 new ActiveXObject("Microsoft.XMLHTTP") 語法,因此流通不廣。

事實上 XMLHTTP 在 ASP 中的使用,和 AJAX 所差無幾,這裡簡單使用 XMLHTTP 檢查是否某一個連結存在。

在 AJAX 中,跨網域連線是不允許的,但在 ASP 中的 XMLHTTP 物件,這方面就沒那麼嚴謹,本例取檔名 linkCheck.asp,使用語法如:

linkCheck.asp?url=http://www.google.com.tw/index.php

如果找不到頁面,直接顯示「找不到頁面」字樣。

原始碼如下:

<%

  • '宣告變數
  • Dim URLs, xml
  •  
  • '建立物件
  • Set xml = Server.CreateObject ("Microsoft.XMLHTTP")
  •  
  • '要檢查的網址
  • URLs = Request("url")
  •  
  • On Error Resume Next
  • xml.Open "GET", URLs, false
  • xml.Send
  •  
  • IF xml.status=404 Then
    • Response.Write "找不到頁面"
  • ELSEIF xml.status=200 Then
    • Response.Write "頁面連線正常"
  • ELSE
    • Response.Write "連線發生錯誤,代碼 "&xml.status
  • END IF
  •  
  • '關閉物件
  • Set xml = Nothing

%>

下載本文 asp 原始檔

卜維丰 3/7 07'

以下為文章回應區

同意轉載,不過麻煩看一下轉載需知

home security camera systems diy   2017/11/14 下午 12:42:00

To shield your children from damage?

Itamar Serpa Fernandes   2017/11/14 上午 01:48:00

Nice post. I was checking continuously this blog and I'm
impressed! Extremely helpful info specifically
the last part :) I care for such information a lot. I
was looking for this particular info for a very long time.
Thank you and good luck.

Lelio Vieira Carneiro Junior   2017/11/10 上午 07:45:00

Hi just wanted to give you a brief heads up and let you know a few of the pictures aren't loading properly.
I'm not sure why but I think its a linking issue. I've tried it in two different browsers and both show the same results.

Do you get taller when you stretch?   2017/8/4 下午 12:48:00

I do not know if it's just me or if everyone else encountering problems with your site.
It looks like some of the written text in your
content are running off the screen. Can somebody else please
provide feedback and let me know if this is happening to them too?
This might be a issue with my internet browser because
I've had this happen before. Thank you

Can you lose weight by doing yoga?   2017/7/31 上午 11:41:00

Thanks designed for sharing such a fastidious thinking, paragraph is good, thats why i have read it fully

   2017/7/31 上午 12:28:00

It's impressive that you are getting ideas from this post as
well as from our dialogue made at this time.

What is leg length discrepancy?   2017/7/28 上午 10:53:00

Hey! This post couldn't be written any better!

Reading through this post reminds me of my previous room mate!

He always kept talking about this. I will forward this
page to him. Fairly certain he will have a good
read. Thank you for sharing!

What do you do when your Achilles tendon hurts?   2017/7/23 下午 08:34:00

Hey I know this is off topic but I was wondering
if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like this for quite
some time and was hoping maybe you would have some experience with
something like this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your new updates.

foot pain after surgery   2017/7/4 上午 05:06:00

Hello my friend! I want to say that this article is amazing, great written and come with approximately all significant infos.
I'd like to peer extra posts like this.

http://yolandalarger.soup.io   2017/6/12 下午 02:07:00

Saved as a favorite, I really like your web site!

manicure   2017/5/4 上午 05:38:00

Hi to all, it's truly a nice for me to pay a quick visit this web site, it consists of important Information.

manicure   2017/4/11 下午 06:50:00

I have been browsing on-line more than three hours today, but I never found any fascinating article like yours.
It's pretty price enough for me. In my view, if all webmasters and bloggers made excellent content as you probably did, the internet will be
much more helpful than ever before.

卜維丰   2009/3/12 下午 06:03:00

WIN, 12029 大約是連線錯誤
詳細代碼表
http://support.microsoft.com/kb/193625

WIN   2009/2/16 上午 04:31:00

另請問有沒有 xml.status 的錯誤代碼編號資料?
謝謝!

WIN   2009/2/16 上午 04:25:00

卜老師您好:
請問 xml.status = 12029 是什麼錯誤?
謝謝!

界展   2009/2/6 下午 03:51:00

卜老師...你好...
想請教您 . 這個 連結網址檢查 範例
是否適用於 php 網站上..

下面這個軟體,是安裝在電腦上的..
常常跑外面就不方便了..
http://www.pota.com.tw/ls_cgi.phpx?cfile=potadetect.htm

想請教老師,有什麼語法可以應用於
PHP的網站上,只要開一個網頁,就可以檢查所有網站是否正常,而不用一個一個網址打...謝謝














給個回應
姓名:
佈落格網址:
  如果您是要發問問題, 最好有個問題測試的網址, 這樣比較容易找到您問題所在, 謝謝
內容: