Professional Web Applications Themes

Postback jumps to different page - ASP.NET General

Hi Suppose this page is currently loaded: [url]http://localhost/myapp/?page=news[/url] 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 ([url]http://localhost/myapp/?page=news[/url]), it jumps to [url]http://localhost/myapp/news/default.aspx[/url]. How to prevent this? I've tried to add the following code to global.asax... Sub Application_EndRequest(Sender As Object, e As EventArgs) If Request.IsAuthenticated And Request.Filepath <> "/myapp/Default.aspx" And IsNothing(Request.Form("__VIEWSTATE")) = False Then Response.Redirect (request.urlreferrer.absoluteuri) End Sub ....but that only created other problems. Anyone?...

  1. #1

    Default Postback jumps to different page

    Hi

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

    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
    ([url]http://localhost/myapp/?page=news[/url]), it jumps to
    [url]http://localhost/myapp/news/default.aspx[/url].

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

    Sub Application_EndRequest(Sender As Object, e As EventArgs)
    If Request.IsAuthenticated And Request.Filepath <> "/myapp/Default.aspx"
    And IsNothing(Request.Form("__VIEWSTATE")) = False Then Response.Redirect
    (request.urlreferrer.absoluteuri)
    End Sub

    ....but that only created other problems.

    Anyone?


    John Knoop Guest

  2. #2

    Default Postback jumps to different page

    hi

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

    regards

    G.Venkat
    >-----Original Message-----
    >Hi
    >
    >Suppose this page is currently loaded:
    [url]http://localhost/myapp/?page=news[/url]
    >
    >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
    >([url]http://localhost/myapp/?page=news[/url]), it jumps to
    >[url]http://localhost/myapp/news/default.aspx[/url].
    >
    >How to prevent this? I've tried to add the following
    code to global.asax...
    >
    >Sub Application_EndRequest(Sender As Object, e As
    EventArgs)
    > If Request.IsAuthenticated And Request.Filepath
    <> "/myapp/Default.aspx"
    >And IsNothing(Request.Form("__VIEWSTATE")) = False Then
    Response.Redirect
    >(request.urlreferrer.absoluteuri)
    >End Sub
    >
    >....but that only created other problems.
    >
    >Anyone?
    >
    >
    >.
    >
    venkat Guest

  3. #3

    Default Re: Postback jumps to different page

    [url]http://localhost/myapp/?page=news[/url] is the same as
    [url]http://localhost/myapp/default.aspx?page=news[/url]

    /john

    "venkat" <senthil_venkathotmail.com> wrote in message
    news:097c01c33c72$473af3d0$a101280aphx.gbl...
    > hi
    >
    > first let me know is this correct?
    > [url]http://localhost/myapp/?page=news[/url]. /?page=news how this
    > will come.
    >
    > regards
    >
    > G.Venkat
    > >-----Original Message-----
    > >Hi
    > >
    > >Suppose this page is currently loaded:
    > [url]http://localhost/myapp/?page=news[/url]
    > >
    > >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
    > >([url]http://localhost/myapp/?page=news[/url]), it jumps to
    > >[url]http://localhost/myapp/news/default.aspx[/url].
    > >
    > >How to prevent this? I've tried to add the following
    > code to global.asax...
    > >
    > >Sub Application_EndRequest(Sender As Object, e As
    > EventArgs)
    > > If Request.IsAuthenticated And Request.Filepath
    > <> "/myapp/Default.aspx"
    > >And IsNothing(Request.Form("__VIEWSTATE")) = False Then
    > Response.Redirect
    > >(request.urlreferrer.absoluteuri)
    > >End Sub
    > >
    > >....but that only created other problems.
    > >
    > >Anyone?
    > >
    > >
    > >.
    > >

    John Knoop Guest

  4. #4

    Default 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.khome.se> wrote in message
    news:OeGBPlGPDHA.2284TK2MSFTNGP11.phx.gbl...
    > Hi
    >
    > Suppose this page is currently loaded: [url]http://localhost/myapp/?page=news[/url]
    >
    > 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
    > ([url]http://localhost/myapp/?page=news[/url]), it jumps to
    > [url]http://localhost/myapp/news/default.aspx[/url].
    >
    > How to prevent this? I've tried to add the following code to
    global.asax...
    >
    > Sub Application_EndRequest(Sender As Object, e As EventArgs)
    > If Request.IsAuthenticated And Request.Filepath <>
    "/myapp/Default.aspx"
    > And IsNothing(Request.Form("__VIEWSTATE")) = False Then Response.Redirect
    > (request.urlreferrer.absoluteuri)
    > End Sub
    >
    > ...but that only created other problems.
    >
    > Anyone?
    >
    >

    andrei Guest

Similar Threads

  1. spry menubar jumps to top of page
    By gizmodesign in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: May 20th, 01:44 AM
  2. Contribute 4 Editing, when typing page jumps to top ofpage
    By Angrist in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: March 3rd, 04:32 PM
  3. How do you do <a> jumps in a Cold Fusion page
    By briankitt in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 28th, 09:08 PM
  4. Update page without postback
    By MA in forum ASP.NET Web Services
    Replies: 6
    Last Post: August 11th, 06:21 PM
  5. Postback behavior always moves you to top of web page
    By Curt in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: October 10th, 10:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139