ASP.NET generates a random file name according to time

zhaozj2021-02-16  87

Function of random file name in ASP, can also be used without modification in ASP.NET

Put it in Module1.vb, declare that the public function can call in any WebForm.

Function makefilename (byval fname) 'Generate file name FNAME = now () fname = replace (FNAME, ",", "") FName = Replace (FNAME, ": "," "" Fname = replace (FNAME, "PM", ") FNAME = Replace (FNAME," AM "," ") FNAME = Replace (FNAME," AM "," ") FNAME = Replace (FNAME, "In the afternoon", "") makefilename = fname & ".htm" end function

Method: Public Sub FileWrite (Byval Str As String, Byval MyfileName As String) 'New Document (Content, Path, File Name)

End Sub

Call FileWrite ("i like asp.net", "path", makefilename ())

转载请注明原文地址:https://www.9cbs.com/read-11733.html

New Post(0)