Postback jumps to different page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Knoop

    Postback jumps to different page

    Hi

    Suppose this page is currently loaded: http://localhost/myapp/?page=news

    Default.aspx in the Myapp folder will then include /news/default.aspx.

    In the file /news/default.aspx there is a <asp:button> that triggers
    Sub_MyClick. But instead of reloading the same page
    (http://localhost/myapp/?page=news), it jumps to
    http://localhost/myapp/news/default.aspx.

    How to prevent this? I've tried to add the following code to global.asax...

    Sub Application_End Request(Sender As Object, e As EventArgs)
    If Request.IsAuthe nticated And Request.Filepat h <> "/myapp/Default.aspx"
    And IsNothing(Reque st.Form("__VIEW STATE")) = False Then Response.Redire ct
    (request.urlref errer.absoluteu ri)
    End Sub

    ....but that only created other problems.

    Anyone?


  • venkat

    #2
    Postback jumps to different page

    hi

    first let me know is this correct?
    http://localhost/myapp/?page=news. /?page=news how this
    will come.

    regards

    G.Venkat[color=blue]
    >-----Original Message-----
    >Hi
    >
    >Suppose this page is currently loaded:[/color]
    http://localhost/myapp/?page=news[color=blue]
    >
    >Default.aspx in the Myapp folder will then[/color]
    include /news/default.aspx.[color=blue]
    >
    >In the file /news/default.aspx there is a <asp:button>[/color]
    that triggers[color=blue]
    >Sub_MyClick. But instead of reloading the same page
    >(http://localhost/myapp/?page=news), it jumps to
    >http://localhost/myapp/news/default.aspx.
    >
    >How to prevent this? I've tried to add the following[/color]
    code to global.asax...[color=blue]
    >
    >Sub Application_End Request(Sender As Object, e As[/color]
    EventArgs)[color=blue]
    > If Request.IsAuthe nticated And Request.Filepat h[/color]
    <> "/myapp/Default.aspx"[color=blue]
    >And IsNothing(Reque st.Form("__VIEW STATE")) = False Then[/color]
    Response.Redire ct[color=blue]
    >(request.urlre ferrer.absolute uri)
    >End Sub
    >
    >....but that only created other problems.
    >
    >Anyone?
    >
    >
    >.
    >[/color]

    Comment

    • John Knoop

      #3
      Re: Postback jumps to different page

      http://localhost/myapp/?page=news is the same as


      /john

      "venkat" <senthil_venkat @hotmail.com> wrote in message
      news:097c01c33c 72$473af3d0$a10 1280a@phx.gbl.. .[color=blue]
      > hi
      >
      > first let me know is this correct?
      > http://localhost/myapp/?page=news. /?page=news how this
      > will come.
      >
      > regards
      >
      > G.Venkat[color=green]
      > >-----Original Message-----
      > >Hi
      > >
      > >Suppose this page is currently loaded:[/color]
      > http://localhost/myapp/?page=news[color=green]
      > >
      > >Default.aspx in the Myapp folder will then[/color]
      > include /news/default.aspx.[color=green]
      > >
      > >In the file /news/default.aspx there is a <asp:button>[/color]
      > that triggers[color=green]
      > >Sub_MyClick. But instead of reloading the same page
      > >(http://localhost/myapp/?page=news), it jumps to
      > >http://localhost/myapp/news/default.aspx.
      > >
      > >How to prevent this? I've tried to add the following[/color]
      > code to global.asax...[color=green]
      > >
      > >Sub Application_End Request(Sender As Object, e As[/color]
      > EventArgs)[color=green]
      > > If Request.IsAuthe nticated And Request.Filepat h[/color]
      > <> "/myapp/Default.aspx"[color=green]
      > >And IsNothing(Reque st.Form("__VIEW STATE")) = False Then[/color]
      > Response.Redire ct[color=green]
      > >(request.urlre ferrer.absolute uri)
      > >End Sub
      > >
      > >....but that only created other problems.
      > >
      > >Anyone?
      > >
      > >
      > >.
      > >[/color][/color]


      Comment

      • andrei

        #4
        Re: Postback jumps to different page

        Hi John,

        Try putting this line in your <head> section of the "news" page:
        <base target="_self">

        Andrei.


        "John Knoop" <john.k@home.se > wrote in message
        news:OeGBPlGPDH A.2284@TK2MSFTN GP11.phx.gbl...[color=blue]
        > Hi
        >
        > Suppose this page is currently loaded: http://localhost/myapp/?page=news
        >
        > Default.aspx in the Myapp folder will then include /news/default.aspx.
        >
        > In the file /news/default.aspx there is a <asp:button> that triggers
        > Sub_MyClick. But instead of reloading the same page
        > (http://localhost/myapp/?page=news), it jumps to
        > http://localhost/myapp/news/default.aspx.
        >
        > How to prevent this? I've tried to add the following code to[/color]
        global.asax...[color=blue]
        >
        > Sub Application_End Request(Sender As Object, e As EventArgs)
        > If Request.IsAuthe nticated And Request.Filepat h <>[/color]
        "/myapp/Default.aspx"[color=blue]
        > And IsNothing(Reque st.Form("__VIEW STATE")) = False Then Response.Redire ct
        > (request.urlref errer.absoluteu ri)
        > End Sub
        >
        > ...but that only created other problems.
        >
        > Anyone?
        >
        >[/color]


        Comment

        Working...