0

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 :)

  • if this is ASP.NET Webforms then why just not use UpdatePanel control for Ajax? https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.updatepanel?view=netframework-4.8 – kshkarin Mar 22 '21 at 22:38
  • i use UpdatePanel but a lot of pages are static aspx files. All data driven pages use angular.js and a json rest api :) – Aleksandar Herbrich Mar 23 '21 at 01:18

0 Answers0