:master: Onestamente, credo che l'unico aiuto che ti si possa dare è dirti che asp.net non è asp e che quello che pretendi di fare (purtroppo) non si può fare:

Questo è un esempio:
codice:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim d As String = Me.Server.MapPath("~/WebCharts")
        Dim n As Integer = -1
        For Each f As String In Directory.GetFiles(d, "*.png")
            n += 1
            Dim hy As New HyperLink()
            hy.ID = "hy_" & n.ToString("000")
            Dim f1 As String = Path.GetFileName(f)
            hy.NavigateUrl = "~/WebCharts/" & f1
            hy.Text = f
            hy.Attributes.Add("rel", "lightbox")
            Me.pnlPagine.Controls.Add(hy)
            Me.pnlPagine.Controls.Add(New LiteralControl("
"))
        Next


    End Sub
In pratica, leggo da una directory dei file di immagini; costruisco i link e aggiungo anche l'attributo per usare lightbox