问题前提:DIM allSTRNG as string 其中我已把allSTRING参数的内容为<ASX VERSION=3.0> <TITLE>【音乐世界】</TITLE><ENTRY><ref href=http://127.0.0.1/musicdata/爱.mp3/></entry><ENTRY><ref href=http://127.0.0.1/musicdata/爱.mp3/></entry><ENTRY><ref href=http://127.0.0.1/musicdata/爸爸妈妈.mp3/></entry></ASX>了,本人想把allSTRING的内容生成一个PLAY.ASX的文件,(此文件是临时的,)通过播放器播放!
孟子那些高手一定会!

解决方案 »

  1.   

    string allSTRNG = "<ASX VERSION=3.0> <TITLE>【音乐世界】</TITLE><ENTRY><ref href=http://127.0.0.1/musicdata/爱.mp3/></entry><ENTRY><ref href=http://127.0.0.1/musicdata/爱.mp3/></entry><ENTRY><ref href=http://127.0.0.1/musicdata/爸爸妈妈.mp3/></entry></ASX>";
    System.IO.StreamWriter sw = new StreamWriter(@"c:\PLAY.ASX", false, System.Text.Encoding.Default);
    try
    {
        sw.Write(allSTRNG);
    }
    finally
    {
        sw.Close();
    }
      

  2.   

    写入文件后可直接启用播放:System.Diagnostics.Process.Start(@"c:\PLAY.ASX");
      

  3.   

    本人如此做法为何不行?文件可以建立,但没有大小是0,里面没内容.
     Dim FS As FileStream
            Dim SW As StreamWriter
            FS = New FileStream(Server.MapPath("play.asx"), FileMode.Create, FileAccess.Write)
            SW = New StreamWriter(FS)
            SW.Write(allSTRING)
            FS.CLOSE
      

  4.   

    还有本人的allstring内容是如此得来的:  For Each gridCHECK In DataGrid2.Items
                strCHECK = gridCHECK.FindControl("checked")
                If strCHECK.Checked = True Then
                    str_STRING = CType(gridCHECK.FindControl("selectON"), Label).Text
                    strID.Add(str_STRING)
                    Dim I As Integer = 0
                    For I = 0 To strID.Count - 1
                        allstring += strID(I)
                    Next
                End If
            Next
    会出现第一条的数据会出现两次!不知如何解决?请高手帮忙.(出现二次这个http://127.0.0.1/musicdata/爱.mp3)