Redirection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nitinkcv
    New Member
    • Mar 2007
    • 65

    Redirection

    Hi,

    i have my app wherein i am redirecting to other pages from my code behind for eg:
    Response.Redire ct("\MyVirtualD irName\Admin.as px").

    However this is a bit tightly bound in the sense that if i were to change the name
    of my virtual directory then the applicatio n would break.

    So if there any other way to do this.. can it be done through the we.config.

    Thanks
  • jitendradotnet
    New Member
    • May 2007
    • 6

    #2
    Originally posted by Nitinkcv
    Hi,

    i have my app wherein i am redirecting to other pages from my code behind for eg:
    Response.Redire ct("\MyVirtualD irName\Admin.as px").

    However this is a bit tightly bound in the sense that if i were to change the name
    of my virtual directory then the applicatio n would break.

    So if there any other way to do this.. can it be done through the we.config.

    Thanks

    It should work.

    Response.Redire ct("~/admin.aspx");

    Happy programming :)

    Comment

    • Nitinkcv
      New Member
      • Mar 2007
      • 65

      #3
      Hi,
      Ya thanks a lot.. however like i also have images whose path are being set using the virtual directory name. But if i use the ~ its not coming proper. Giving like:
      images/ad.gif instead of /VirDirName/images/ad.gif works well for those files which are not inside any folders.

      If some files are inside a folder and i were to give images/ad.gif then the images are not displayed properly.

      Thankx.

      Comment

      • jitendradotnet
        New Member
        • May 2007
        • 6

        #4
        Originally posted by Nitinkcv
        Hi,
        Ya thanks a lot.. however like i also have images whose path are being set using the virtual directory name. But if i use the ~ its not coming proper. Giving like:
        images/ad.gif instead of /VirDirName/images/ad.gif works well for those files which are not inside any folders.

        If some files are inside a folder and i were to give images/ad.gif then the images are not displayed properly.

        Thankx.

        <img src="~/images/ad.gif" />

        It will work.

        enjoy :)

        Comment

        • Nitinkcv
          New Member
          • Mar 2007
          • 65

          #5
          Hi,

          Please note im not geeting the oimages properly linked. If i right click on the image
          and click properties im getting its path as http://localhost/MyVirDirec/~/images/ad.gif instead of
          http://localhost/MyVirDirec/images/ad.gif

          what could be the prob?

          Thanks

          Comment

          • jitendradotnet
            New Member
            • May 2007
            • 6

            #6
            Originally posted by Nitinkcv
            Hi,

            Please note im not geeting the oimages properly linked. If i right click on the image
            and click properties im getting its path as http://localhost/MyVirDirec/~/images/ad.gif instead of
            http://localhost/MyVirDirec/images/ad.gif

            what could be the prob?

            Thanks

            <image src="images/ad.gif" />

            Now use this only.

            Probably it will work.

            Comment

            • Nitinkcv
              New Member
              • Mar 2007
              • 65

              #7
              Hi,

              no that wont work coz it takes it to the directory above.. like the image link is
              localhost/images instaed of localhost/VirDirecName/images.

              Comment

              • leela mn
                New Member
                • May 2007
                • 43

                #8
                try ths
                ../images/ad.gif

                Comment

                • Nitinkcv
                  New Member
                  • Mar 2007
                  • 65

                  #9
                  Hi,

                  sorry even thats not working for the files which are inside the folder.. its working for for the ones which are in the folder where the images folder is..

                  Thanks

                  Comment

                  • leela mn
                    New Member
                    • May 2007
                    • 43

                    #10
                    first u freeze the folder in which all u r images to be there
                    then u can use ../images/filename

                    Comment

                    • Nitinkcv
                      New Member
                      • Mar 2007
                      • 65

                      #11
                      Hi,

                      i wuite didnt undrstand what u meant by freeze the folder.. could u explain a bit more plz?

                      Thanks

                      Comment

                      • leela mn
                        New Member
                        • May 2007
                        • 43

                        #12
                        i mean to say place all your images in one folder.

                        Comment

                        • Nitinkcv
                          New Member
                          • Mar 2007
                          • 65

                          #13
                          hi,

                          alll my images are in one folder.. i think u didnt understand me..
                          The thing is all the pages which are in the same directory as tyhe images folder are properly linking with the images.. but i have the pages inside the admin folder are not..
                          Heirarchy:
                          Main folder: contains page1.aspx, page2.aspx, images folder and admin folder
                          admin folder: contains admin1.aspx, admin2 .aspx.

                          Problem: page1.aspx, page2.aspx are linking properly with the images inside the images folder . but the admin1.aspx, admin2 .aspx. are not linking properly with the images inside the images folder.

                          Hope this is clear.
                          Thanks

                          Comment

                          • Frinavale
                            Recognized Expert Expert
                            • Oct 2006
                            • 9749

                            #14
                            Originally posted by Nitinkcv
                            hi,

                            alll my images are in one folder.. i think u didnt understand me..
                            The thing is all the pages which are in the same directory as tyhe images folder are properly linking with the images.. but i have the pages inside the admin folder are not..
                            Heirarchy:
                            Main folder: contains page1.aspx, page2.aspx, images folder and admin folder
                            admin folder: contains admin1.aspx, admin2 .aspx.

                            Problem: page1.aspx, page2.aspx are linking properly with the images inside the images folder . but the admin1.aspx, admin2 .aspx. are not linking properly with the images inside the images folder.

                            Hope this is clear.
                            Thanks
                            If the user is visiting your site they are at

                            ~/webAppLocation/adminFolder/admin1.aspx.

                            To reach the images properly from admin1.aspx you'll have to use:

                            ../images/imageName.jpg

                            This will bring you up one directory from the admin folder and then into the images folder.

                            Comment

                            • Nitinkcv
                              New Member
                              • Mar 2007
                              • 65

                              #15
                              Code:
                              If the user is visiting your site they are at
                              
                              ~/webAppLocation/adminFolder/admin1.aspx.
                              
                              To reach the images properly from admin1.aspx you'll have to use:
                              
                              ../images/imageName.jpg
                              
                              This will bring you up one directory from the admin folder and then into the images folder.
                              Hi,

                              im using a common page which has images and their links. This page is used as the reference fo all other pages to display the images the images. ie page1.aspx ans well as admin1.aspx are referencing this common page to get the images.

                              So if in the src tag of the images i were to give ../images/imageName.jpg then would it properly link with both the page1.aspx and asmin1.aspx. Since the ../ would take it to one directory up, would it link with page1.aspx. I think it would link with admin1.aspx.

                              Thanks

                              Comment

                              Working...