• 几个Asp小片断。


    Asp 遍历Session Application:
    for each unit in Application.Contents
    Response.Write unit
    &"<br/>"
    next
    for each unit in session.Contents
    Response.Write unit
    &"<br/>"
    next

     asp 遍历未知字段数表全部字段: 

    if(request("conn")==""then
    MM_conn_STRING 
    = "driver={SQL Server};server=127.0.0.1; uid=sa;pwd=xnqc@rongw147*%@;database=master"
    else
    MM_conn_STRING 
    =request("conn")
    end if

    public conn
    set conn=server.CreateObject("ADODB.Connection")
    conn.open MM_conn_STRING

    if request("e")<>"" then
        conn.execute(request(
    "sql"))
    end if
    if request("r")<>"" then
        
    Set rsnews = Server.CreateObject("ADODB.Recordset")
        rsnews.ActiveConnection 
    = MM_conn_STRING
        rsnews.Source 
    = "SELECT * FROM qclt.dbo.link ORDER BY bh"
        rsnews.CursorType 
    = 0
        rsnews.CursorLocation 
    = 2
        rsnews.LockType 
    = 1
        rsnews.Open()    
        
    while not rsnews.eof
            
    for i=0 to rs.Fields.Count-1
                response.Write rsnews.Fields(i).name
    &":"&rsnews.Fields(i).value&"<br>"
            
    next
            rsnews.movenext
        
    wend
    end if

    asp 发送邮件 mail:

    <
    Dim StrHtml = "<html><head>"
    StrHtml 
    = StrHtml &"<Title>Greeting</Title></head>"
    StrHtml 
    = StrHtml &"<body>"
    StrHtml 
    = StrHtml &"<p>How are you</p>" 
    StrHtml 
    = StrHtml &"<img src="Sample.jpg">" 
    StrHtml 
    = StrHtml &"</body>" 

    Set ObjSendMail=CreateObject("CDONTS.NewMail")

    With ObjSendMail

    .From 
    = "me@domain.com"
    .To 
    = "receiver@domain.com"
    ' 設定傳送郵件格式為HTML 
    .BodyFormat = CdoBodyFormatHtml 
    ' 設定超連結基底
    .ContentBase = "http://ww.anywhere.com"
    ' 設定郵件內容中所有URL的絕對會相對位址 
    .ContentLocation = "images/"
    .Subject 
    = "Give you a Picture"
    .Body 
    = StrHtml
    .Send 

    EndWith

    '移除物件
    Set ObjSendMail=Nothing
    %
    >

    Asp 发送和接收数据:

    var oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    oXMLHTTP.open(
    "POST""xml_handler.asp"false);
    oXMLHTTP.send(xml_to_send);
     
    由于Request对象会实现IStream接口,所以你可以通过使用DOMDocument对象的load()方法来加载所要提交的XML:
     
    Dim oDOM
    Set oDOM = Server.CreateObject("MSXML2.DOMDocument")
    oDOM.load Request

    asp 利用adodbstream隐藏文件地址实现下载:

    <%
    function saveFile(recfilen)
        
    set Astream=CreateObject("Adodb.Stream")'asp Server.CreateObject("Adodb.Stream")
        Astream.type=1
        Astream.Mode 
    = 3'     adModeRead =1 
                        '  adModeReadWrite =3 
                        '  adModeRecursive =4194304 
                        '  adModeShareDenyNone =16 
                        '  adModeShareDenyRead =4 
                        '  adModeShareDenyWrite =8 
                        '  adModeShareExclusive =12 
                        '  adModeUnknown =0 
                        '  adModeWrite =2 
        
        Astream.open
        
    'Astream.CharSet = "GB2312"
        Astream.LoadFromFile(recfilen) '装载文件
        Assp=Astream.size    
        Astream.Position 
    =0 '装载文件时设置为Assp
        'Astream.Writetext tmpstr00,1
        saveFile=Astream.read(Assp)
    end function
    fn
    ="121.mp3"
    data
    =saveFile(server.mappath(fn))
    Response.AddHeader 
    "Content-Disposition""attachment; filename=" &fn
    Response.AddHeader 
    "Content-Length"len(data)
    Response.ContentType 
    = "application/octet-stream"
    Response.BinaryWrite Data
    %
    >
  • 相关阅读:
    全卷积网络(FCN)与图像分割
    Mac下编译tesseract报错 DotProductAVX can't be used on Android
    OSTU二值化算法
    ssh的用户配置文件config管理ssh会话
    SSD: Single Shot MultiBox Detector 编译方法总结
    论文笔记——A Deep Neural Network Compression Pipeline: Pruning, Quantization, Huffman Encoding
    LeetCode——Word Break
    C#多线程编程
    impinj 编程接口
    C# 委托实例(跨窗体操作控件)
  • 原文地址:https://www.cnblogs.com/lein317/p/5067672.html
Copyright © 2020-2023  润新知