<div class="advert" style="width: 60%; text-align: center; cursor :pointer;">
<asp:Image ID="Image1" runat="server" Width="100%" AlternateText="" ImageUrl="~/Images/Slide/LOGIN/2009200836335615.jpg" />
<asp:SlideShowExtender ID="SlideShowExtender" runat="server" TargetControlID="Image1"
SlideShowServiceMethod="GetImages" AutoPlay="true" PlayInterval="2000" Loop="true">
</asp:SlideShowExtender>
</div>
<WebMethod()>
<ScriptMethod()>
Public Shared Function GetImages() As Slide()
Try
Dim slides As New List(Of Slide)()
Dim sPath As String = HttpContext.Current.Server.MapPath("~/Images/Slide/LOGIN")
Dim DocPath As String = ""
If sPath.EndsWith("\") Then
sPath = sPath.Remove(sPath.Length - 1)
End If
Dim info As DirectoryInfo = New DirectoryInfo(sPath)
Dim files1 As FileInfo() = info.GetFiles().OrderByDescending(Function(DateTime) DateTime.CreationTime).ToArray()
Dim ObjDt As DataTable
Dim ObjUser As New User
ObjDt = ObjUser.ListLoginSlideShowImage()
If ObjDt.Rows.Count > 0 Then
For i As Integer = 0 To ObjDt.Rows.Count - 1
DocPath = Convert.ToString(ObjDt.Rows(i)("imagepath"))
If DocPath.Contains("~") Then
DocPath = Replace(DocPath, "~", "")
End If
If DocPath <> "" Then
slides.Add(New Slide(DocPath, CStr(i) & "Login", Convert.ToString(ObjDt.Rows(i)("imagepath"))))
End If
Next
End If
Return slides.ToArray()
Catch ex As Exception
Throw ex
End Try
End Function