Developing multiple applications

Discussion in 'ASP .Net' started by =?Utf-8?B?QWRyaWFu?=, Jul 25, 2005.

  1. I have a really newbie question... I developed an asp.net application. By
    default, it was created here:

    c:\inetpub\wwwroot\

    Now, I wanted to create another application, completely independent. I
    placed it here:

    c:\inetpub\wwwroot\testapp\

    The problem is that now, in the second application any reference to "/"
    doesn't refer to the root of the second application, as I would expect, but
    to the root of the main application... For instance if I have this:

    <img src="/images/image1.gif">

    I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    Instead, it points to:
    c:\inetpub\wwwroot\images\image1.gif

    Obviously, I could write all my links to include the testapp subdir, but the
    reality is that the second application will be deployed on it's own server
    and therefore over there it will point to the root. So, I cannot find a way
    to develop this on the same machine... Am I missing something?
    As a workaround I defined a key in the web.config and I put in there a
    "suffix" which I apply to all links and on the developlement machine is
    "/testapp" and on the production server it is ""... But really, I should be
    able to develop 2 independent applications on the same machine....

    Any help would be appreciated,

    Thank you,
    Adrian
    =?Utf-8?B?QWRyaWFu?=, Jul 25, 2005
    #1
    1. Advertising

  2. Adrian,

    Try this:

    <img src="~/images/image1.gif" runat="server">

    --
    Tu-Thach


    "Adrian" wrote:

    > I have a really newbie question... I developed an asp.net application. By
    > default, it was created here:
    >
    > c:\inetpub\wwwroot\
    >
    > Now, I wanted to create another application, completely independent. I
    > placed it here:
    >
    > c:\inetpub\wwwroot\testapp\
    >
    > The problem is that now, in the second application any reference to "/"
    > doesn't refer to the root of the second application, as I would expect, but
    > to the root of the main application... For instance if I have this:
    >
    > <img src="/images/image1.gif">
    >
    > I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    > Instead, it points to:
    > c:\inetpub\wwwroot\images\image1.gif
    >
    > Obviously, I could write all my links to include the testapp subdir, but the
    > reality is that the second application will be deployed on it's own server
    > and therefore over there it will point to the root. So, I cannot find a way
    > to develop this on the same machine... Am I missing something?
    > As a workaround I defined a key in the web.config and I put in there a
    > "suffix" which I apply to all links and on the developlement machine is
    > "/testapp" and on the production server it is ""... But really, I should be
    > able to develop 2 independent applications on the same machine....
    >
    > Any help would be appreciated,
    >
    > Thank you,
    > Adrian
    =?Utf-8?B?VHUtVGhhY2g=?=, Jul 25, 2005
    #2
    1. Advertising

  3. Either develop on a test server so that you can have multiple sites defined
    in IIS and don't have to worry about this, or when you're working on this
    site, set that physical directory to be the root of your site in IIS and
    switch to the other one when you're working on that.

    Ray at work

    "Adrian" <> wrote in message
    news:...
    > I have a really newbie question... I developed an asp.net application. By
    > default, it was created here:
    >
    > c:\inetpub\wwwroot\
    >
    > Now, I wanted to create another application, completely independent. I
    > placed it here:
    >
    > c:\inetpub\wwwroot\testapp\
    >
    > The problem is that now, in the second application any reference to "/"
    > doesn't refer to the root of the second application, as I would expect,

    but
    > to the root of the main application... For instance if I have this:
    >
    > <img src="/images/image1.gif">
    >
    > I would expect this to point to:

    c:\inetpub\wwwroot\testapp\images\image1.gif
    > Instead, it points to:
    > c:\inetpub\wwwroot\images\image1.gif
    >
    > Obviously, I could write all my links to include the testapp subdir, but

    the
    > reality is that the second application will be deployed on it's own server
    > and therefore over there it will point to the root. So, I cannot find a

    way
    > to develop this on the same machine... Am I missing something?
    > As a workaround I defined a key in the web.config and I put in there a
    > "suffix" which I apply to all links and on the developlement machine is
    > "/testapp" and on the production server it is ""... But really, I should

    be
    > able to develop 2 independent applications on the same machine....
    >
    > Any help would be appreciated,
    >
    > Thank you,
    > Adrian
    Ray Costanzo [MVP], Jul 25, 2005
    #3
  4. try this out "../images/image1.gif"

    Create folder structure like this and use above path.

    C:\inetpub\wwwroot\
    Testapp1 folder
    images
    css
    js

    Testapp2 folder
    images
    css
    js
    Let me know if it doesn't works out.

    "Adrian" wrote:

    > I have a really newbie question... I developed an asp.net application. By
    > default, it was created here:
    >
    > c:\inetpub\wwwroot\
    >
    > Now, I wanted to create another application, completely independent. I
    > placed it here:
    >
    > c:\inetpub\wwwroot\testapp\
    >
    > The problem is that now, in the second application any reference to "/"
    > doesn't refer to the root of the second application, as I would expect, but
    > to the root of the main application... For instance if I have this:
    >
    > <img src="/images/image1.gif">
    >
    > I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    > Instead, it points to:
    > c:\inetpub\wwwroot\images\image1.gif
    >
    > Obviously, I could write all my links to include the testapp subdir, but the
    > reality is that the second application will be deployed on it's own server
    > and therefore over there it will point to the root. So, I cannot find a way
    > to develop this on the same machine... Am I missing something?
    > As a workaround I defined a key in the web.config and I put in there a
    > "suffix" which I apply to all links and on the developlement machine is
    > "/testapp" and on the production server it is ""... But really, I should be
    > able to develop 2 independent applications on the same machine....
    >
    > Any help would be appreciated,
    >
    > Thank you,
    > Adrian
    =?Utf-8?B?SEFSSSBQUkFTRCBCQVJV?=, Jul 25, 2005
    #4
  5. You've been given a couple of suggestions.

    The real answer, however, is that you shouldn't
    create an application in the root directory.

    *All* applications should be located in subdirectories of the
    root directory, which should *never* be an application itself.

    That way, using
    <img src="/images/image1.gif">
    would work in *all* applications, because there
    wouldn't be a reference below any application's directory.





    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Adrian" <> wrote in message
    news:...
    >I have a really newbie question... I developed an asp.net application. By
    > default, it was created here:
    >
    > c:\inetpub\wwwroot\
    >
    > Now, I wanted to create another application, completely independent. I
    > placed it here:
    >
    > c:\inetpub\wwwroot\testapp\
    >
    > The problem is that now, in the second application any reference to "/"
    > doesn't refer to the root of the second application, as I would expect, but
    > to the root of the main application... For instance if I have this:
    >
    > <img src="/images/image1.gif">
    >
    > I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    > Instead, it points to:
    > c:\inetpub\wwwroot\images\image1.gif
    >
    > Obviously, I could write all my links to include the testapp subdir, but the
    > reality is that the second application will be deployed on it's own server
    > and therefore over there it will point to the root. So, I cannot find a way
    > to develop this on the same machine... Am I missing something?
    > As a workaround I defined a key in the web.config and I put in there a
    > "suffix" which I apply to all links and on the developlement machine is
    > "/testapp" and on the production server it is ""... But really, I should be
    > able to develop 2 independent applications on the same machine....
    >
    > Any help would be appreciated,
    >
    > Thank you,
    > Adrian
    Juan T. Llibre, Jul 25, 2005
    #5
  6. Hmm... Thanks, this seems to make a lot of sense... Ok, I will do a suicidal
    attempt and move the app 1 in its own dir and cancel the application at the
    root level. If I never reply it means it didn't work and I jumped out the
    window :) I'm kidding, I will backup first...

    Thanks again!!
    Adrian

    "Juan T. Llibre" wrote:

    > You've been given a couple of suggestions.
    >
    > The real answer, however, is that you shouldn't
    > create an application in the root directory.
    >
    > *All* applications should be located in subdirectories of the
    > root directory, which should *never* be an application itself.
    >
    > That way, using
    > <img src="/images/image1.gif">
    > would work in *all* applications, because there
    > wouldn't be a reference below any application's directory.
    >
    >
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "Adrian" <> wrote in message
    > news:...
    > >I have a really newbie question... I developed an asp.net application. By
    > > default, it was created here:
    > >
    > > c:\inetpub\wwwroot\
    > >
    > > Now, I wanted to create another application, completely independent. I
    > > placed it here:
    > >
    > > c:\inetpub\wwwroot\testapp\
    > >
    > > The problem is that now, in the second application any reference to "/"
    > > doesn't refer to the root of the second application, as I would expect, but
    > > to the root of the main application... For instance if I have this:
    > >
    > > <img src="/images/image1.gif">
    > >
    > > I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    > > Instead, it points to:
    > > c:\inetpub\wwwroot\images\image1.gif
    > >
    > > Obviously, I could write all my links to include the testapp subdir, but the
    > > reality is that the second application will be deployed on it's own server
    > > and therefore over there it will point to the root. So, I cannot find a way
    > > to develop this on the same machine... Am I missing something?
    > > As a workaround I defined a key in the web.config and I put in there a
    > > "suffix" which I apply to all links and on the developlement machine is
    > > "/testapp" and on the production server it is ""... But really, I should be
    > > able to develop 2 independent applications on the same machine....
    > >
    > > Any help would be appreciated,
    > >
    > > Thank you,
    > > Adrian

    >
    >
    >
    =?Utf-8?B?QWRyaWFu?=, Jul 25, 2005
    #6
  7. heh, heh...

    I hope I see your reply.

    ;-)



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Adrian" <> wrote in message
    news:...
    > Hmm... Thanks, this seems to make a lot of sense... Ok, I will do a suicidal
    > attempt and move the app 1 in its own dir and cancel the application at the
    > root level. If I never reply it means it didn't work and I jumped out the
    > window :) I'm kidding, I will backup first...
    >
    > Thanks again!!
    > Adrian


    > "Juan T. Llibre" wrote:
    >
    >> You've been given a couple of suggestions.
    >>
    >> The real answer, however, is that you shouldn't
    >> create an application in the root directory.
    >>
    >> *All* applications should be located in subdirectories of the
    >> root directory, which should *never* be an application itself.
    >>
    >> That way, using
    >> <img src="/images/image1.gif">
    >> would work in *all* applications, because there
    >> wouldn't be a reference below any application's directory.
    >>
    >>
    >>
    >>
    >>
    >> Juan T. Llibre
    >> ASP.NET MVP
    >> http://asp.net.do/foros/
    >> Foros de ASP.NET en Español
    >> Ven, y hablemos de ASP.NET...
    >> ======================
    >>
    >> "Adrian" <> wrote in message
    >> news:...
    >> >I have a really newbie question... I developed an asp.net application. By
    >> > default, it was created here:
    >> >
    >> > c:\inetpub\wwwroot\
    >> >
    >> > Now, I wanted to create another application, completely independent. I
    >> > placed it here:
    >> >
    >> > c:\inetpub\wwwroot\testapp\
    >> >
    >> > The problem is that now, in the second application any reference to "/"
    >> > doesn't refer to the root of the second application, as I would expect, but
    >> > to the root of the main application... For instance if I have this:
    >> >
    >> > <img src="/images/image1.gif">
    >> >
    >> > I would expect this to point to: c:\inetpub\wwwroot\testapp\images\image1.gif
    >> > Instead, it points to:
    >> > c:\inetpub\wwwroot\images\image1.gif
    >> >
    >> > Obviously, I could write all my links to include the testapp subdir, but the
    >> > reality is that the second application will be deployed on it's own server
    >> > and therefore over there it will point to the root. So, I cannot find a way
    >> > to develop this on the same machine... Am I missing something?
    >> > As a workaround I defined a key in the web.config and I put in there a
    >> > "suffix" which I apply to all links and on the developlement machine is
    >> > "/testapp" and on the production server it is ""... But really, I should be
    >> > able to develop 2 independent applications on the same machine....
    >> >
    >> > Any help would be appreciated,
    >> >
    >> > Thank you,
    >> > Adrian

    >>
    >>
    >>
    Juan T. Llibre, Jul 26, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Turner
    Replies:
    6
    Views:
    543
    Andy Turner
    Nov 3, 2003
  2. =?Utf-8?B?VGluYQ==?=
    Replies:
    2
    Views:
    457
    Guadala Harry
    Nov 4, 2004
  3. Pret Orian
    Replies:
    1
    Views:
    395
  4. Neetesh Singhal

    Developing Enterprise applications

    Neetesh Singhal, Jun 6, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    313
    =?Utf-8?B?RGVtZXRyaQ==?=
    Jun 6, 2006
  5. Replies:
    24
    Views:
    1,562
Loading...

Share This Page