render ContentPlaceHolder without MasterPage

67 Views Asked by At

I wanna render a aspx content without the MasterPage and return that as string for ajax requests. When i call RenderControll on the LoadEvent of the root level MasterPage, then i got the full html of the page.

My first aproach with a http module has failed.

Protected Sub HandleRydelRequest()
    If (Me.JenniFrame.Response.ContentType = "text/html ") Then
        Me.JenniFrame.Response.Write(Me.JenniFrame.Request.ApplicationPath)
        Dim t As Type = GetType(Page)
        Dim site As Page = CType(BuildManager.CreateInstanceFromVirtualPath(Me.JenniFrame.Request.ApplicationPath, t), Page)
        site.MasterPageFile = "~/Site.Render.master"
        Dim w As New StringWriter, h As New HtmlTextWriter(w, vbTab)
        Me.JenniFrame.Response.Write(w.ToString())

        Me.JenniFrame.Response.End()
    End If
End Sub

called by

Private Sub JenniFrame_BeginRequest(sender As Object, e As EventArgs) Handles JenniFrame.BeginRequest

I hope 4 any helpfull ideas or hints how i can acomplish to the goal.

Greatings from Hamburg Germany and hack the planet :)

0

There are 0 best solutions below