Redirect to root page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rudy Soto

    Redirect to root page

    Can someone please tell me how I can redirect the user back to the
    start page? Let's say I have the following folders in IIS, with the
    pages included:

    Menu
    login.aspx
    menu.aspx
    Customers
    details.aspx
    contacts.aspx
    address.aspx

    menu.aspx also has other folders. It is basically the entry point for
    multiple projects. Anyway, if a user has already navigated to
    contacts.aspx for example, I want them to be able to return straight to
    menu.aspx. If they have already logged in they will not be redirected
    to login.aspx.

    I've tried the following in the code behind of an asp:button, which is
    part of a user control (hope that makes sense):

    Response.Redire ct("https://menu.mycompany. com/menu.aspx")
    Response.Redire ct("~/menu/menu.aspx")
    Response.Redire ct("/menu/menu.aspx")

    None of these work. Does anyone have any suggestions? Maybe
    Response.Redire ct isn't even close to what I need to use?

    Thanks.
    Rudy

  • Rob Schieber

    #2
    Re: Redirect to root page

    Rudy Soto wrote:[color=blue]
    > Can someone please tell me how I can redirect the user back to the
    > start page? Let's say I have the following folders in IIS, with the
    > pages included:
    >
    > Menu
    > login.aspx
    > menu.aspx
    > Customers
    > details.aspx
    > contacts.aspx
    > address.aspx
    >
    > menu.aspx also has other folders. It is basically the entry point for
    > multiple projects. Anyway, if a user has already navigated to
    > contacts.aspx for example, I want them to be able to return straight to
    > menu.aspx. If they have already logged in they will not be redirected
    > to login.aspx.
    >
    > I've tried the following in the code behind of an asp:button, which is
    > part of a user control (hope that makes sense):
    >
    > Response.Redire ct("https://menu.mycompany. com/menu.aspx")
    > Response.Redire ct("~/menu/menu.aspx")
    > Response.Redire ct("/menu/menu.aspx")
    >
    > None of these work. Does anyone have any suggestions? Maybe
    > Response.Redire ct isn't even close to what I need to use?
    >
    > Thanks.
    > Rudy
    >[/color]
    Try Response.Redire ct("../menu/menu.aspx");

    --
    Rob Schieber

    Comment

    • Rudy Soto

      #3
      Re: Redirect to root page

      Rob,

      Thanks for the quick reply. I did try that and it worked.....on my
      development machine. For some reason when we put it on the web server,
      it does not. Any idea what the difference could be? Is there
      something in the directory structure of IIS that we need to modify?

      Thanks.
      Rudy

      Comment

      • Rob Schieber

        #4
        Re: Redirect to root page

        Rudy Soto wrote:[color=blue]
        > Rob,
        >
        > Thanks for the quick reply. I did try that and it worked.....on my
        > development machine. For some reason when we put it on the web server,
        > it does not. Any idea what the difference could be? Is there
        > something in the directory structure of IIS that we need to modify?
        >
        > Thanks.
        > Rudy
        >[/color]

        Hi Rudy,

        That is the standard way to redirect, it should work on anny IIS asp
        application. Is it possible that you didn't recompile the application
        and redeploy the binary file?

        --
        Rob Schieber

        Comment

        • Peter Rilling

          #5
          Re: Redirect to root page

          When you run your site, what does happen? Do you get an exception or a 404
          page? What is the URL in the address bar and how does that compare with
          your actual tree structure?

          "Rudy Soto" <rudys@betenbou gh.com> wrote in message
          news:1127845089 .632365.100200@ o13g2000cwo.goo glegroups.com.. .[color=blue]
          > Rob,
          >
          > Thanks for the quick reply. I did try that and it worked.....on my
          > development machine. For some reason when we put it on the web server,
          > it does not. Any idea what the difference could be? Is there
          > something in the directory structure of IIS that we need to modify?
          >
          > Thanks.
          > Rudy
          >[/color]


          Comment

          • rviray

            #6
            Re: Redirect to root page


            Rudy -

            use "~/<subfolder1>/<subfolder2><Pa ge>.aspx" To all the way back to
            original folder, if your in some nested subfolder.

            use "../" to go back one subfolder up the tree

            use "../../<Page>.aspx" to go two subfolders up the tree (so-on and so
            forth)

            if your going to have a complicated subtree structure, then I would
            create a Page (i.e., Default.aspx) that contains the logic of where the
            end user will go (use Session objects or Query String to figure that
            logic out). But then do a Response.Redire ct("~/default.aspx") on all
            your click events no matter where your at in the tree structure...

            it may have a lot of bouncing along...from page to defaultpage to real
            page, but the code would be pretty easy to follow...


            --
            rviray
            ------------------------------------------------------------------------
            rviray's Profile: http://www.msusenet.com/member.php?userid=4211
            View this thread: http://www.msusenet.com/t-1871083597

            Comment

            • Rudy Soto

              #7
              Re: Redirect to root page

              It appears to just refresh whatever page it is currently on. The url
              in the address bar does not change. The status bar does not show the
              target url, because it is an asp:button and not an asp:linkbutton
              (which may be part of the problem I guess). For example, the current
              page I am looking at has this in the url:



              When I click the button nothing appears to happen except maybe a
              refresh. The code currently behind the button is:

              Response.Redire ct("https://menu.mycompany. com/menu.aspx")

              That is the url of the page I want to redirect to (names have been
              changed to protect the innocent).

              Rudy

              Comment

              Working...