Server.MapPath connection string question.

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

    Server.MapPath connection string question.

    I have two sites:

    www.site_A.com & www.site_A_news.com

    Site_A is in d:\webs\site_a & uses an Access DB in
    d:\webs\site_a\ data\db.mdb

    Site_A_news is in d:\webs\site_a\ site_a_news also requires access to
    that Access Database.

    How should I setup the connection string so both webs can share the same
    database?
  • TomB

    #2
    Re: Server.MapPath connection string question.

    I assume this is the same server since you didn't say otherwise.
    site_a should continue as is.
    site_a_news should use D:\webs\site_a\ data\db.mdb in its connection string.

    A different (likely better) solution would be to move the database to
    d:\database\db. mdb and both site_a and site_a_news can get to it from there.

    MSDE would likely be even better.

    TomB


    "Dave" <1@1.ca> wrote in message
    news:uCjtu%23DO EHA.2780@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > I have two sites:
    >
    > www.site_A.com & www.site_A_news.com
    >
    > Site_A is in d:\webs\site_a & uses an Access DB in
    > d:\webs\site_a\ data\db.mdb
    >
    > Site_A_news is in d:\webs\site_a\ site_a_news also requires access to
    > that Access Database.
    >
    > How should I setup the connection string so both webs can share the same
    > database?[/color]


    Comment

    • Dave

      #3
      Re: Server.MapPath connection string question.

      Yes, same server - sorry. And I agree, MSDE would be better, but I do
      not have that option at the moment.

      Right now, I have both setup to use the full path
      D:\webs\site_a\ data\db.mdb in their connection strings...

      Any reason why I should NOT do that?

      Why do many example of DSN Less connection strings use Server.MapPath?

      Any performance gains by doing that? Security considerations?



      TomB wrote:
      [color=blue]
      > I assume this is the same server since you didn't say otherwise.
      > site_a should continue as is.
      > site_a_news should use D:\webs\site_a\ data\db.mdb in its connection string.
      >
      > A different (likely better) solution would be to move the database to
      > d:\database\db. mdb and both site_a and site_a_news can get to it from there.
      >
      > MSDE would likely be even better.
      >
      > TomB
      >
      >
      > "Dave" <1@1.ca> wrote in message
      > news:uCjtu%23DO EHA.2780@TK2MSF TNGP09.phx.gbl. ..
      >[color=green]
      >>I have two sites:
      >>
      >>www.site_A.com & www.site_A_news.com
      >>
      >>Site_A is in d:\webs\site_a & uses an Access DB in
      >>d:\webs\site_ a\data\db.mdb
      >>
      >>Site_A_news is in d:\webs\site_a\ site_a_news also requires access to
      >>that Access Database.
      >>
      >>How should I setup the connection string so both webs can share the same
      >>database?[/color]
      >
      >
      >[/color]

      Comment

      • Dave

        #4
        Re: Server.MapPath connection string question.

        Yes, same server - sorry. And I agree, MSDE would be better, but I do
        not have that option at the moment.

        Right now, I have both setup to use the full path
        D:\webs\site_a\ data\db.mdb in their connection strings...

        Any reason why I should NOT do that?

        Why do many example of DSN Less connection strings use Server.MapPath?

        Any performance gains by doing that? Security considerations?



        TomB wrote:
        [color=blue]
        > I assume this is the same server since you didn't say otherwise.
        > site_a should continue as is.
        > site_a_news should use D:\webs\site_a\ data\db.mdb in its connection string.
        >
        > A different (likely better) solution would be to move the database to
        > d:\database\db. mdb and both site_a and site_a_news can get to it from there.
        >
        > MSDE would likely be even better.
        >
        > TomB
        >
        >
        > "Dave" <1@1.ca> wrote in message
        > news:uCjtu%23DO EHA.2780@TK2MSF TNGP09.phx.gbl. ..
        >[color=green]
        >>I have two sites:
        >>
        >>www.site_A.com & www.site_A_news.com
        >>
        >>Site_A is in d:\webs\site_a & uses an Access DB in
        >>d:\webs\site_ a\data\db.mdb
        >>
        >>Site_A_news is in d:\webs\site_a\ site_a_news also requires access to
        >>that Access Database.
        >>
        >>How should I setup the connection string so both webs can share the same
        >>database?[/color]
        >
        >
        >[/color]

        Comment

        • TomB

          #5
          Re: Server.MapPath connection string question.

          The downside to having your database within your site, is that a user could
          type in the url to the database and download it.
          http://site_a/data/db.mdb
          To fix, you can rename the database db.asp

          I think the main reasons for using Server.MapPath are
          a) if it's sample code they don't know where you are going to put it
          b) if you move the site to a new server, or a new directory, the link is
          relative so it won't break.

          Tom B

          "Dave" <1@1.ca> wrote in message
          news:ujWcKNEOEH A.3264@tk2msftn gp13.phx.gbl...[color=blue]
          > Yes, same server - sorry. And I agree, MSDE would be better, but I do
          > not have that option at the moment.
          >
          > Right now, I have both setup to use the full path
          > D:\webs\site_a\ data\db.mdb in their connection strings...
          >
          > Any reason why I should NOT do that?
          >
          > Why do many example of DSN Less connection strings use Server.MapPath?
          >
          > Any performance gains by doing that? Security considerations?
          >
          >
          >
          > TomB wrote:
          >[color=green]
          > > I assume this is the same server since you didn't say otherwise.
          > > site_a should continue as is.
          > > site_a_news should use D:\webs\site_a\ data\db.mdb in its connection[/color][/color]
          string.[color=blue][color=green]
          > >
          > > A different (likely better) solution would be to move the database to
          > > d:\database\db. mdb and both site_a and site_a_news can get to it from[/color][/color]
          there.[color=blue][color=green]
          > >
          > > MSDE would likely be even better.
          > >
          > > TomB
          > >
          > >
          > > "Dave" <1@1.ca> wrote in message
          > > news:uCjtu%23DO EHA.2780@TK2MSF TNGP09.phx.gbl. ..
          > >[color=darkred]
          > >>I have two sites:
          > >>
          > >>www.site_A.com & www.site_A_news.com
          > >>
          > >>Site_A is in d:\webs\site_a & uses an Access DB in
          > >>d:\webs\site_ a\data\db.mdb
          > >>
          > >>Site_A_news is in d:\webs\site_a\ site_a_news also requires access to
          > >>that Access Database.
          > >>
          > >>How should I setup the connection string so both webs can share the same
          > >>database?[/color]
          > >
          > >
          > >[/color][/color]


          Comment

          • Dave

            #6
            Re: Server.MapPath connection string question.

            Thanks Tom.

            One final question.. how could the web user download the db? How would
            (could) they find out the path?

            TomB wrote:[color=blue]
            > The downside to having your database within your site, is that a user could
            > type in the url to the database and download it.
            > http://site_a/data/db.mdb
            > To fix, you can rename the database db.asp
            >
            > I think the main reasons for using Server.MapPath are
            > a) if it's sample code they don't know where you are going to put it
            > b) if you move the site to a new server, or a new directory, the link is
            > relative so it won't break.
            >
            > Tom B
            >
            > "Dave" <1@1.ca> wrote in message
            > news:ujWcKNEOEH A.3264@tk2msftn gp13.phx.gbl...
            >[color=green]
            >>Yes, same server - sorry. And I agree, MSDE would be better, but I do
            >>not have that option at the moment.
            >>
            >>Right now, I have both setup to use the full path
            >>D:\webs\site_ a\data\db.mdb in their connection strings...
            >>
            >>Any reason why I should NOT do that?
            >>
            >>Why do many example of DSN Less connection strings use Server.MapPath?
            >>
            >>Any performance gains by doing that? Security considerations?
            >>
            >>
            >>
            >>TomB wrote:
            >>
            >>[color=darkred]
            >>>I assume this is the same server since you didn't say otherwise.
            >>>site_a should continue as is.
            >>>site_a_new s should use D:\webs\site_a\ data\db.mdb in its connection[/color][/color]
            >
            > string.
            >[color=green][color=darkred]
            >>>A different (likely better) solution would be to move the database to
            >>>d:\database\ db.mdb and both site_a and site_a_news can get to it from[/color][/color]
            >
            > there.
            >[color=green][color=darkred]
            >>>MSDE would likely be even better.
            >>>
            >>>TomB
            >>>
            >>>
            >>>"Dave" <1@1.ca> wrote in message
            >>>news:uCjtu%2 3DOEHA.2780@TK2 MSFTNGP09.phx.g bl...
            >>>
            >>>
            >>>>I have two sites:
            >>>>
            >>>>www.site_A.com & www.site_A_news.com
            >>>>
            >>>>Site_A is in d:\webs\site_a & uses an Access DB in
            >>>>d:\webs\sit e_a\data\db.mdb
            >>>>
            >>>>Site_A_ne ws is in d:\webs\site_a\ site_a_news also requires access to
            >>>>that Access Database.
            >>>>
            >>>>How should I setup the connection string so both webs can share the same
            >>>>database?
            >>>
            >>>
            >>>[/color][/color]
            >
            >[/color]

            Comment

            • TomB

              #7
              Re: Server.MapPath connection string question.

              Usually just by sheer luck.
              However, other things can happen.

              a) Perhaps a user hits an error and the error message says something that
              gives it away.
              b) Your asp page doesn't get processed for some reason, and the source code
              is displayed instead.
              c) You accidentally allow directory browsing and don't have a default page.
              d) Good guesswork.
              e) Once a person posted a question on a newsgroup with their real email
              address (the usual NOSPAM was in there) and because of the information they
              provided, their database could easily have been downloaded. Note I've seen
              this with SQL too, people posting straight from their source with IP of
              their server, username and password. Invariably it's sa.

              All in all it's pretty unlikely to happen. But it could.
              TomB


              "Dave" <1@1.ca> wrote in message
              news:eyl0aGGOEH A.3016@tk2msftn gp13.phx.gbl...[color=blue]
              > Thanks Tom.
              >
              > One final question.. how could the web user download the db? How would
              > (could) they find out the path?
              >
              > TomB wrote:[color=green]
              > > The downside to having your database within your site, is that a user[/color][/color]
              could[color=blue][color=green]
              > > type in the url to the database and download it.
              > > http://site_a/data/db.mdb
              > > To fix, you can rename the database db.asp
              > >
              > > I think the main reasons for using Server.MapPath are
              > > a) if it's sample code they don't know where you are going to put it
              > > b) if you move the site to a new server, or a new directory, the link is
              > > relative so it won't break.
              > >
              > > Tom B
              > >
              > > "Dave" <1@1.ca> wrote in message
              > > news:ujWcKNEOEH A.3264@tk2msftn gp13.phx.gbl...
              > >[color=darkred]
              > >>Yes, same server - sorry. And I agree, MSDE would be better, but I do
              > >>not have that option at the moment.
              > >>
              > >>Right now, I have both setup to use the full path
              > >>D:\webs\site_ a\data\db.mdb in their connection strings...
              > >>
              > >>Any reason why I should NOT do that?
              > >>
              > >>Why do many example of DSN Less connection strings use Server.MapPath?
              > >>
              > >>Any performance gains by doing that? Security considerations?
              > >>
              > >>
              > >>
              > >>TomB wrote:
              > >>
              > >>
              > >>>I assume this is the same server since you didn't say otherwise.
              > >>>site_a should continue as is.
              > >>>site_a_new s should use D:\webs\site_a\ data\db.mdb in its connection[/color]
              > >
              > > string.
              > >[color=darkred]
              > >>>A different (likely better) solution would be to move the database to
              > >>>d:\database\ db.mdb and both site_a and site_a_news can get to it from[/color]
              > >
              > > there.
              > >[color=darkred]
              > >>>MSDE would likely be even better.
              > >>>
              > >>>TomB
              > >>>
              > >>>
              > >>>"Dave" <1@1.ca> wrote in message
              > >>>news:uCjtu%2 3DOEHA.2780@TK2 MSFTNGP09.phx.g bl...
              > >>>
              > >>>
              > >>>>I have two sites:
              > >>>>
              > >>>>www.site_A.com & www.site_A_news.com
              > >>>>
              > >>>>Site_A is in d:\webs\site_a & uses an Access DB in
              > >>>>d:\webs\sit e_a\data\db.mdb
              > >>>>
              > >>>>Site_A_ne ws is in d:\webs\site_a\ site_a_news also requires access to
              > >>>>that Access Database.
              > >>>>
              > >>>>How should I setup the connection string so both webs can share the[/color][/color][/color]
              same[color=blue][color=green][color=darkred]
              > >>>>database?
              > >>>
              > >>>
              > >>>[/color]
              > >
              > >[/color][/color]


              Comment

              • Dave

                #8
                Re: Server.MapPath connection string question.

                Good points, thanks Tom. I'll adjust accordingly :)

                TomB wrote:
                [color=blue]
                > Usually just by sheer luck.
                > However, other things can happen.
                >
                > a) Perhaps a user hits an error and the error message says something that
                > gives it away.
                > b) Your asp page doesn't get processed for some reason, and the source code
                > is displayed instead.
                > c) You accidentally allow directory browsing and don't have a default page.
                > d) Good guesswork.
                > e) Once a person posted a question on a newsgroup with their real email
                > address (the usual NOSPAM was in there) and because of the information they
                > provided, their database could easily have been downloaded. Note I've seen
                > this with SQL too, people posting straight from their source with IP of
                > their server, username and password. Invariably it's sa.
                >
                > All in all it's pretty unlikely to happen. But it could.
                > TomB
                >
                >
                > "Dave" <1@1.ca> wrote in message
                > news:eyl0aGGOEH A.3016@tk2msftn gp13.phx.gbl...
                >[color=green]
                >>Thanks Tom.
                >>
                >>One final question.. how could the web user download the db? How would
                >>(could) they find out the path?
                >>
                >>TomB wrote:
                >>[color=darkred]
                >>>The downside to having your database within your site, is that a user[/color][/color]
                >
                > could
                >[color=green][color=darkred]
                >>>type in the url to the database and download it.
                >>>http://site_a/data/db.mdb
                >>>To fix, you can rename the database db.asp
                >>>
                >>>I think the main reasons for using Server.MapPath are
                >>>a) if it's sample code they don't know where you are going to put it
                >>>b) if you move the site to a new server, or a new directory, the link is
                >>>relative so it won't break.
                >>>
                >>>Tom B
                >>>
                >>>"Dave" <1@1.ca> wrote in message
                >>>news:ujWcKNE OEHA.3264@tk2ms ftngp13.phx.gbl ...
                >>>
                >>>
                >>>>Yes, same server - sorry. And I agree, MSDE would be better, but I do
                >>>>not have that option at the moment.
                >>>>
                >>>>Right now, I have both setup to use the full path
                >>>>D:\webs\sit e_a\data\db.mdb in their connection strings...
                >>>>
                >>>>Any reason why I should NOT do that?
                >>>>
                >>>>Why do many example of DSN Less connection strings use Server.MapPath?
                >>>>
                >>>>Any performance gains by doing that? Security considerations?
                >>>>
                >>>>
                >>>>
                >>>>TomB wrote:
                >>>>
                >>>>
                >>>>
                >>>>>I assume this is the same server since you didn't say otherwise.
                >>>>>site_a should continue as is.
                >>>>>site_a_new s should use D:\webs\site_a\ data\db.mdb in its connection
                >>>
                >>>string.
                >>>
                >>>
                >>>>>A different (likely better) solution would be to move the database to
                >>>>>d:\databas e\db.mdb and both site_a and site_a_news can get to it from
                >>>
                >>>there.
                >>>
                >>>
                >>>>>MSDE would likely be even better.
                >>>>>
                >>>>>TomB
                >>>>>
                >>>>>
                >>>>>"Dave" <1@1.ca> wrote in message
                >>>>>news:uCjtu %23DOEHA.2780@T K2MSFTNGP09.phx .gbl...
                >>>>>
                >>>>>
                >>>>>
                >>>>>>I have two sites:
                >>>>>>
                >>>>>>www.site_A.com & www.site_A_news.com
                >>>>>>
                >>>>>>Site_A is in d:\webs\site_a & uses an Access DB in
                >>>>>>d:\webs\s ite_a\data\db.m db
                >>>>>>
                >>>>>>Site_A_ne ws is in d:\webs\site_a\ site_a_news also requires access to
                >>>>>>that Access Database.
                >>>>>>
                >>>>>>How should I setup the connection string so both webs can share the[/color][/color]
                >
                > same
                >[color=green][color=darkred]
                >>>>>>databas e?
                >>>>>
                >>>>>
                >>>>>
                >>>[/color][/color]
                >
                >[/color]

                Comment

                Working...