Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dev vs Production environments ASP.NET

Dev vs Production environments ASP.NET

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiocombusiness
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim Featherston
    wrote on last edited by
    #1

    I am working on my first ASP.NET web application in a business environment and I am trying to figure out a better way to move code between the development site (a virtual directory) where the root directory is AName/.... to the web site where aName is the web site name. Right now if I have an image in a folder path /AName/images/something.gif is the path for the virtual directory site in developoment. When we move to our web site the path would be /images/something.gif. When I am getting ready to move th ecode, I do a global find an dreplace on /AName/ then build, move the dll's and apsx, etc files to a install folder, then do a global replace back on "/ changin git back to "/AName/. Pretty hokey, huh? There has got to be a better way. Thanks, TF Tim Featherston www.QBSix.com

    M 1 Reply Last reply
    0
    • T Tim Featherston

      I am working on my first ASP.NET web application in a business environment and I am trying to figure out a better way to move code between the development site (a virtual directory) where the root directory is AName/.... to the web site where aName is the web site name. Right now if I have an image in a folder path /AName/images/something.gif is the path for the virtual directory site in developoment. When we move to our web site the path would be /images/something.gif. When I am getting ready to move th ecode, I do a global find an dreplace on /AName/ then build, move the dll's and apsx, etc files to a install folder, then do a global replace back on "/ changin git back to "/AName/. Pretty hokey, huh? There has got to be a better way. Thanks, TF Tim Featherston www.QBSix.com

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Tim. If it were me, I would reference things like images using relative references... "images/something.gif" rather than "/AName/images/something.gif". I think you can also use "~/images/something.gif" (I'm not sure about this, but I think the tilde represents the root directory of the web application provided it's setup as a virtual directory through IIS manager... someone correct me on this if I'm wrong please).

      T 1 Reply Last reply
      0
      • M Mike Ellison

        Hi Tim. If it were me, I would reference things like images using relative references... "images/something.gif" rather than "/AName/images/something.gif". I think you can also use "~/images/something.gif" (I'm not sure about this, but I think the tilde represents the root directory of the web application provided it's setup as a virtual directory through IIS manager... someone correct me on this if I'm wrong please).

        T Offline
        T Offline
        Tim Featherston
        wrote on last edited by
        #3

        Thanks Mike for the quick reply. I am probably not expressign myself correctly. My dev site is in a virtual directory named cardss. The production site is CARDSS. The site folder structure looks like this: Virtual Dir Web Site cardss/Images /Images cardss/Operations /Operations If a web page in the Operations folder: cardss/Operations/page.aspx has a reference to something in the images folder, /cardss/images/a.gif would be the path in the dev environment, /images/a.gif on the web site. The tilde does represent root directory on for code running on server side but it translates to ../ and we can't use ../ because of security issues. I assume everyone develops ASP.NET in virtual directories? When you move code to the production website, how do you deal with the fact that the virtual directory root (cardss) doesn't exist at the web site? TF Tim Featherston www.QBSix.com

        M 1 Reply Last reply
        0
        • T Tim Featherston

          Thanks Mike for the quick reply. I am probably not expressign myself correctly. My dev site is in a virtual directory named cardss. The production site is CARDSS. The site folder structure looks like this: Virtual Dir Web Site cardss/Images /Images cardss/Operations /Operations If a web page in the Operations folder: cardss/Operations/page.aspx has a reference to something in the images folder, /cardss/images/a.gif would be the path in the dev environment, /images/a.gif on the web site. The tilde does represent root directory on for code running on server side but it translates to ../ and we can't use ../ because of security issues. I assume everyone develops ASP.NET in virtual directories? When you move code to the production website, how do you deal with the fact that the virtual directory root (cardss) doesn't exist at the web site? TF Tim Featherston www.QBSix.com

          M Offline
          M Offline
          Mike Ellison
          wrote on last edited by
          #4

          Hi Tim. Why not set the directory cardss as the root for your Virtual Directory on the development box? Then a simple copy to the production is all you'll need.

          T 1 Reply Last reply
          0
          • M Mike Ellison

            Hi Tim. Why not set the directory cardss as the root for your Virtual Directory on the development box? Then a simple copy to the production is all you'll need.

            T Offline
            T Offline
            Tim Featherston
            wrote on last edited by
            #5

            You mean the add the cards directory to the production Server? https://CARDSS/cardss/default.aspx ?? I guess that would do it, eh? It just doesn't seem right! Now the dev tool dictates how you organize your web site? We even tried to pick up a variable from the web.config (appsetting section) where we would set a value either "/" or "/Cardss/" but some tags don't accept a variable for the path. TF Tim Featherston www.QBSix.com

            M 1 Reply Last reply
            0
            • T Tim Featherston

              You mean the add the cards directory to the production Server? https://CARDSS/cardss/default.aspx ?? I guess that would do it, eh? It just doesn't seem right! Now the dev tool dictates how you organize your web site? We even tried to pick up a variable from the web.config (appsetting section) where we would set a value either "/" or "/Cardss/" but some tags don't accept a variable for the path. TF Tim Featherston www.QBSix.com

              M Offline
              M Offline
              Mike Ellison
              wrote on last edited by
              #6

              Hi Tim. No, actually I meant on the development server, make sure the "cardss" directory is the root of the virtual directory for that web application.

              T 1 Reply Last reply
              0
              • M Mike Ellison

                Hi Tim. No, actually I meant on the development server, make sure the "cardss" directory is the root of the virtual directory for that web application.

                T Offline
                T Offline
                Tim Featherston
                wrote on last edited by
                #7

                I think it is. Currently the folder is: inetpub/wwwroot/cardss Tim Featherston www.QBSix.com

                M 1 Reply Last reply
                0
                • T Tim Featherston

                  I think it is. Currently the folder is: inetpub/wwwroot/cardss Tim Featherston www.QBSix.com

                  M Offline
                  M Offline
                  Mike Ellison
                  wrote on last edited by
                  #8

                  Hi Tim. Okay, I see what you mean. I still think that the organization of your development "cardss" directory could be set up to mirror your production webroot directory in a way that you wouldn't have to change code, provided you are using relative references... it would mean using syntax like "..\images\myImage.gif" to indicate the "images" folder is the parent to the current folder. If that's not a possibility for you, I found a couple of alternatives that you may want to try. The tilde character does appear to be translated by ASP.NET as the virtual root of the web application, so provided you add "runat='server'" to your <img> tags, this might work for you:

                  <img src="~/Images/myImage.gif" runat="server">

                  I read another alternative on the web that used an ASP.NET binding expression syntax to accomplish about the same thing:

                  <img src="<%=Request.ApplicationPath%>/Images/myImage.gif">

                  Let me know if any of these suggestions help. I'm really curious now about how you decide to resolve this one.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups