468,103 Members | 1,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

Virtual Directory not working

I have a site www.stf.com and a site www.stfstage.com (where I do all my
testing).

The problem is that www.stfstage.com is only internal and I need to get
access from the outside (without creating a new domain).

I tried to create a Virtual directory inside my stf site so that I would
access it like: www.stf.com/stage/.

I run as www.stfstage.com fine and have for a long time.

But if I try to do it as www.stf.com/stage/ I get the error:

************************************
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: The module 'ScollKeeperModule' is already in the
application and cannot be added again

Source Error:

Line 33: </webServices>
Line 34: <httpModules>
Line 35: <add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
Line 36: name="ScollKeeperModule" />
Line 37: </httpModules>
Source File: C:\Inetpub\wwwroot\StfStage\web.config Line: 35
************************************
<configuration>
<configSections>
<section name="scrollKeeper"
type="NFission.WebControls.ScrollKeeperConfigHandl er,NFission.WebControls.ScrollKeeper"/>
</configSections>
<scrollKeeper default="true">
<page name="testRIA.aspx" scrollKeep="false" />
<page name="JpegImage.aspx" scrollKeep="false" />
<page name="JpegImage2.aspx" scrollKeep="false" />
<page name="/employer/registerEmployer.aspx" scrollKeep="false" />
</scrollKeeper>
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<pages validateRequest="false" />
<customErrors mode="Off" />
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="400"
/>
<authentication mode="Forms">
<forms name="staffing"
loginUrl="/applicant/ee_logon.aspx"
timeout="400"
protection="All"
path="/" />
</authentication>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<httpModules>
<add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
name="ScollKeeperModule" />
</httpModules>
<httpHandlers>
<add verb="*" path="MetaBuilders_DialogWindow.axd"
type="MetaBuilders.WebControls.DialogImageHandler,
MetaBuilders.WebControls.DialogWindow" />
<add verb="GET"
path="FtbWebResource.axd"
type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
<add verb="GET" path="CaptchaImage.aspx"
type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha" />
</httpHandlers>
</system.web>
</configuration>
************************************************** **********************************

Scrollkeeper is apparently causing the problem but only as a Virtual
directory. It works fine when I access it as www.stfstage.com.

If I take out the ScrollKeeper sections it seems to have a problem with
virtual paths and gets an error:
************************************************** *************************************
The virtual path '/skins/mth/MainPage.ascx' maps to another application,
which is not allowed.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The virtual path
'/skins/mth/MainPage.ascx' maps to another application, which is not
allowed.

Source Error:

Line 27: navigation = "NavigateTop" & ".ascx"
Line 28: end if
Line 29: pageControl = LoadControl(thePage)
Line 30: thePlaceHolder.Controls.Add(pageControl)
Line 31: contentControl =
CType(thePlaceHolder.FindControl("_ctl0:Navigation "),Control)

Source File: C:\Inetpub\wwwroot\StfStage\jobSeeker\displaycompa nyJobs.aspx
Line: 29
************************************************** *************************************

My code that is causing the problem is:

tePage = "/skins/" & session("CompanyInitials") & "/" & "MainPage" &
".ascx"
pageControl = LoadControl(thePage)

How can I make this work in my scenario - or can I?

Thanks,

Tom
Aug 23 '07 #1
4 2996
1. web.config files are inheritable.
So in your case when you have www.stf.com/stage/ ASP.NET takes web.config
from www.stf.com folder and merges it with www.stf.com/stage/ folder. That
is why you get an error "The module 'ScollKeeperModule' is already in the
application and cannot be added again"

2. When you go by www.stf.com/stage/ your root is considered to be
www.stf.com and /stage/ is subfolder. so when you refer to your controls as
'/skins/mth/MainPage.ascx' you actually refer to
www.stf.com/skins/mth/MainPage.ascx which is another application and you can
not do that. And ASP.NET pollitely tells you about it.

You should use ~/ so it will be '~/skins/mth/MainPage.ascx'. ~ symbol means
in root of application. So in your case the ASP.NET will translate it as
www.stf.com/stage/skins/mth/MainPage.ascx

You can use ~ anywere in a code that processed by ASP.NET
Example:
<img src="~/myimge.gif"-- will not work. The ASP.NET does not parse plain
HTML.
<img src="~/myimge.gif" runat=server--will work correctly. ASP.NET parses
out any tag that marked as runat=server.
George.

"tshad" <t@home.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
>I have a site www.stf.com and a site www.stfstage.com (where I do all my
testing).

The problem is that www.stfstage.com is only internal and I need to get
access from the outside (without creating a new domain).

I tried to create a Virtual directory inside my stf site so that I would
access it like: www.stf.com/stage/.

I run as www.stfstage.com fine and have for a long time.

But if I try to do it as www.stf.com/stage/ I get the error:

************************************
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.

Parser Error Message: The module 'ScollKeeperModule' is already in the
application and cannot be added again

Source Error:

Line 33: </webServices>
Line 34: <httpModules>
Line 35: <add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
Line 36: name="ScollKeeperModule" />
Line 37: </httpModules>
Source File: C:\Inetpub\wwwroot\StfStage\web.config Line: 35
************************************
<configuration>
<configSections>
<section name="scrollKeeper"
type="NFission.WebControls.ScrollKeeperConfigHandl er,NFission.WebControls.ScrollKeeper"/>
</configSections>
<scrollKeeper default="true">
<page name="testRIA.aspx" scrollKeep="false" />
<page name="JpegImage.aspx" scrollKeep="false" />
<page name="JpegImage2.aspx" scrollKeep="false" />
<page name="/employer/registerEmployer.aspx" scrollKeep="false" />
</scrollKeeper>
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<pages validateRequest="false" />
<customErrors mode="Off" />
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="400"
/>
<authentication mode="Forms">
<forms name="staffing"
loginUrl="/applicant/ee_logon.aspx"
timeout="400"
protection="All"
path="/" />
</authentication>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<httpModules>
<add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
name="ScollKeeperModule" />
</httpModules>
<httpHandlers>
<add verb="*" path="MetaBuilders_DialogWindow.axd"
type="MetaBuilders.WebControls.DialogImageHandler,
MetaBuilders.WebControls.DialogWindow" />
<add verb="GET"
path="FtbWebResource.axd"
type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
<add verb="GET" path="CaptchaImage.aspx"
type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha" />
</httpHandlers>
</system.web>
</configuration>
************************************************** **********************************

Scrollkeeper is apparently causing the problem but only as a Virtual
directory. It works fine when I access it as www.stfstage.com.

If I take out the ScrollKeeper sections it seems to have a problem with
virtual paths and gets an error:
************************************************** *************************************
The virtual path '/skins/mth/MainPage.ascx' maps to another application,
which is not allowed.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The virtual path
'/skins/mth/MainPage.ascx' maps to another application, which is not
allowed.

Source Error:

Line 27: navigation = "NavigateTop" & ".ascx"
Line 28: end if
Line 29: pageControl = LoadControl(thePage)
Line 30: thePlaceHolder.Controls.Add(pageControl)
Line 31: contentControl =
CType(thePlaceHolder.FindControl("_ctl0:Navigation "),Control)

Source File: C:\Inetpub\wwwroot\StfStage\jobSeeker\displaycompa nyJobs.aspx
Line: 29
************************************************** *************************************

My code that is causing the problem is:

tePage = "/skins/" & session("CompanyInitials") & "/" & "MainPage" &
".ascx"
pageControl = LoadControl(thePage)

How can I make this work in my scenario - or can I?

Thanks,

Tom

Aug 23 '07 #2
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
1. web.config files are inheritable.
So in your case when you have www.stf.com/stage/ ASP.NET takes web.config
from www.stf.com folder and merges it with www.stf.com/stage/ folder. That
is why you get an error "The module 'ScollKeeperModule' is already in the
application and cannot be added again"
Then is there no way to do this?

I need to have ScrollKeeper in my system but I need to call it both ways: as
a website (www.stfstage.com) and as a virtual directory (www.stf.com/stage).

Also, I don't have a problem with any of the other entries in the web.config
files, such as the appSettings:

<appSettings>
<add key="ConnectionString" value="Persist Security Info=False;Data
Source=xx;Initial Catalog=yy;User ID=zz;Password=ff;"/>
</appSettings>

In my case, I have a different database for my live application and one for
my development site. In this case, which one would it use? The one from
www.stf.com or the one from the www.stf.com/stage folder?
2. When you go by www.stf.com/stage/ your root is considered to be
www.stf.com and /stage/ is subfolder. so when you refer to your controls
as '/skins/mth/MainPage.ascx' you actually refer to
www.stf.com/skins/mth/MainPage.ascx which is another application and you
can not do that. And ASP.NET pollitely tells you about it.

You should use ~/ so it will be '~/skins/mth/MainPage.ascx'. ~ symbol
means in root of application. So in your case the ASP.NET will translate
it as www.stf.com/stage/skins/mth/MainPage.ascx

You can use ~ anywere in a code that processed by ASP.NET
Example:
<img src="~/myimge.gif"-- will not work. The ASP.NET does not parse
plain HTML.
<img src="~/myimge.gif" runat=server--will work correctly. ASP.NET
parses out any tag that marked as runat=server.
That seems to work as you say.

I did do a trace on this page and here is what it is showing:

PATH_INFO /stage/JobSeeker/displayCompanyJobs.aspx
PATH_TRANSLATED
C:\Inetpub\wwwroot\StfStage\JobSeeker\displayCompa nyJobs.aspx

So the system knows what the path is so I am not sure why I need the "~" but
it does work. As you say if I do:

<img src="~/myimge.gif">

It doesn't work and shows as a broken gif. But

<img src="/myimge.gif">

does seem to work and knows to look at the root of the Application. I would
have thought that .net objects would do the same (would have been more
consistent). I would have thought that you would use the "~" for the
exceptions. Oh well.

The other thing that doesn't seem to work is:

<img src="../../myimge.gif">

Which works fine if I call it from www.stfstage.com but why wouldn't it work
here? It has nothing to do with the root of the Application.

Thanks,

Tom
>

George.

"tshad" <t@home.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
>>I have a site www.stf.com and a site www.stfstage.com (where I do all my
testing).

The problem is that www.stfstage.com is only internal and I need to get
access from the outside (without creating a new domain).

I tried to create a Virtual directory inside my stf site so that I would
access it like: www.stf.com/stage/.

I run as www.stfstage.com fine and have for a long time.

But if I try to do it as www.stf.com/stage/ I get the error:

************************************
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.

Parser Error Message: The module 'ScollKeeperModule' is already in the
application and cannot be added again

Source Error:

Line 33: </webServices>
Line 34: <httpModules>
Line 35: <add
type="NFission.WebControls.ScrollKeeperModule,NFi ssion.WebControls.ScrollKeeper"
Line 36: name="ScollKeeperModule" />
Line 37: </httpModules>
Source File: C:\Inetpub\wwwroot\StfStage\web.config Line: 35
************************************
<configuration>
<configSections>
<section name="scrollKeeper"
type="NFission.WebControls.ScrollKeeperConfigHand ler,NFission.WebControls.ScrollKeeper"/>
</configSections>
<scrollKeeper default="true">
<page name="testRIA.aspx" scrollKeep="false" />
<page name="JpegImage.aspx" scrollKeep="false" />
<page name="JpegImage2.aspx" scrollKeep="false" />
<page name="/employer/registerEmployer.aspx" scrollKeep="false" />
</scrollKeeper>
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<pages validateRequest="false" />
<customErrors mode="Off" />
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="400"
/>
<authentication mode="Forms">
<forms name="staffing"
loginUrl="/applicant/ee_logon.aspx"
timeout="400"
protection="All"
path="/" />
</authentication>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<httpModules>
<add
type="NFission.WebControls.ScrollKeeperModule,NFi ssion.WebControls.ScrollKeeper"
name="ScollKeeperModule" />
</httpModules>
<httpHandlers>
<add verb="*" path="MetaBuilders_DialogWindow.axd"
type="MetaBuilders.WebControls.DialogImageHandler,
MetaBuilders.WebControls.DialogWindow" />
<add verb="GET"
path="FtbWebResource.axd"
type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
<add verb="GET" path="CaptchaImage.aspx"
type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha" />
</httpHandlers>
</system.web>
</configuration>
************************************************* ***********************************

Scrollkeeper is apparently causing the problem but only as a Virtual
directory. It works fine when I access it as www.stfstage.com.

If I take out the ScrollKeeper sections it seems to have a problem with
virtual paths and gets an error:
************************************************* **************************************
The virtual path '/skins/mth/MainPage.ascx' maps to another application,
which is not allowed.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The virtual path
'/skins/mth/MainPage.ascx' maps to another application, which is not
allowed.

Source Error:

Line 27: navigation = "NavigateTop" & ".ascx"
Line 28: end if
Line 29: pageControl = LoadControl(thePage)
Line 30: thePlaceHolder.Controls.Add(pageControl)
Line 31: contentControl =
CType(thePlaceHolder.FindControl("_ctl0:Navigatio n"),Control)

Source File:
C:\Inetpub\wwwroot\StfStage\jobSeeker\displaycomp anyJobs.aspx Line: 29
************************************************* **************************************

My code that is causing the problem is:

tePage = "/skins/" & session("CompanyInitials") & "/" & "MainPage" &
".ascx"
pageControl = LoadControl(thePage)

How can I make this work in my scenario - or can I?

Thanks,

Tom


Aug 23 '07 #3
1. I am not sure about configuration section. May be that part is not
inheritable. But you can have ScrollKeeperModule in both web.config
sections.
You can remove it first and then add. Look in MSDN (do not know exact
syntax)
something like
<httpModules>
<remove name="ScollKeeperModule">
<add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
name="ScollKeeperModule" />
</httpModules>

2. "/myimage.gif" works simply because you have same folders/files in
www.stf.com as in www.stf.com/stage

the page in www.stf.com/stage that references a /myimage.gif is actually
referencing www.stf.com/myimage.gif and not www.stf.com/stage/myimage.gif

When you prefix path with / (like myimage.gif) it's called absolute path.
Browser automaticly adds server name to get full URL.
When you do not have / (like ../../myimage.gif) then it's called relative
path and browser automaticly appends the path of the current page to it. It
has nothing to do with ASP.NET. It's how browser works. If you using ~ in
ASP.NET then ASP.NET engine converts ~ to absolute path and appends current
application folder. So if you look at the HTML source you will not see ~ you
will see /stage/

Example: if you page's url is http://www.stf.com/stage/folder1/mypage.aspx
and that page had an <img src="../../myimge.gif">
then you actually refer to
http://www.stf.com/stage/folder1/../..myimage.gif" wich in turn is
http://www.stf.com/myimage.gif
if that page had an <img src="/myimage.gif" then it refers to
http://www.stf.com/myimage.gif
if that page had an <img src="myimage.gif" then it refers to
http://www.stf.com/stage/folder1/myimage.gif
George.



"tshad" <t@home.comwrote in message
news:uB**************@TK2MSFTNGP05.phx.gbl...
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
>1. web.config files are inheritable.
So in your case when you have www.stf.com/stage/ ASP.NET takes web.config
from www.stf.com folder and merges it with www.stf.com/stage/ folder.
That is why you get an error "The module 'ScollKeeperModule' is already
in the application and cannot be added again"
Then is there no way to do this?

I need to have ScrollKeeper in my system but I need to call it both ways:
as a website (www.stfstage.com) and as a virtual directory
(www.stf.com/stage).

Also, I don't have a problem with any of the other entries in the
web.config files, such as the appSettings:

<appSettings>
<add key="ConnectionString" value="Persist Security Info=False;Data
Source=xx;Initial Catalog=yy;User ID=zz;Password=ff;"/>
</appSettings>

In my case, I have a different database for my live application and one
for my development site. In this case, which one would it use? The one
from www.stf.com or the one from the www.stf.com/stage folder?
>2. When you go by www.stf.com/stage/ your root is considered to be
www.stf.com and /stage/ is subfolder. so when you refer to your controls
as '/skins/mth/MainPage.ascx' you actually refer to
www.stf.com/skins/mth/MainPage.ascx which is another application and you
can not do that. And ASP.NET pollitely tells you about it.

You should use ~/ so it will be '~/skins/mth/MainPage.ascx'. ~ symbol
means in root of application. So in your case the ASP.NET will translate
it as www.stf.com/stage/skins/mth/MainPage.ascx

You can use ~ anywere in a code that processed by ASP.NET
Example:
<img src="~/myimge.gif"-- will not work. The ASP.NET does not parse
plain HTML.
<img src="~/myimge.gif" runat=server--will work correctly. ASP.NET
parses out any tag that marked as runat=server.

That seems to work as you say.

I did do a trace on this page and here is what it is showing:

PATH_INFO /stage/JobSeeker/displayCompanyJobs.aspx
PATH_TRANSLATED
C:\Inetpub\wwwroot\StfStage\JobSeeker\displayCompa nyJobs.aspx

So the system knows what the path is so I am not sure why I need the "~"
but it does work. As you say if I do:

<img src="~/myimge.gif">

It doesn't work and shows as a broken gif. But

<img src="/myimge.gif">

does seem to work and knows to look at the root of the Application. I
would have thought that .net objects would do the same (would have been
more consistent). I would have thought that you would use the "~" for the
exceptions. Oh well.

The other thing that doesn't seem to work is:

<img src="../../myimge.gif">

Which works fine if I call it from www.stfstage.com but why wouldn't it
work here? It has nothing to do with the root of the Application.

Thanks,

Tom
>>

George.


Aug 23 '07 #4
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
1. I am not sure about configuration section. May be that part is not
inheritable. But you can have ScrollKeeperModule in both web.config
sections.
You can remove it first and then add. Look in MSDN (do not know exact
syntax)
something like
<httpModules>
<remove name="ScollKeeperModule">
<add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
name="ScollKeeperModule" />
</httpModules>
I tried that, but it won't work.

If I add the remove statement to the the Web.Config section of the
www.stfstage.com site, the error about it already being there is gone. But
if I run it as:

www.stf.com/stage

I get the error:

Parser Error Message: Exception in configuration section handler.

Source Error:

Line 3: <section name="scrollKeeper"
type="NFission.WebControls.ScrollKeeperConfigHandl er,NFission.WebControls.ScrollKeeper"/>
Line 4: </configSections>
Line 5: <scrollKeeper default="true">
<--- This is the error
Line 6: <page name="testRIA.aspx" scrollKeep="false" />
Line 7: <page name="JpegImage.aspx" scrollKeep="false" />

If I do it from www.stfstage.com, I get the error:

Parser Error Message: There is no 'ScollKeeperModule' module in the
application to remove.

Source Error:

Line 33: </webServices>
Line 34: <httpModules>
Line 35: <remove name="ScollKeeperModule"/>
Line 36: <add
type="NFission.WebControls.ScrollKeeperModule,NFis sion.WebControls.ScrollKeeper"
Line 37: name="ScollKeeperModule" />

I kind of expected this error, since it would not have been added in the stf
website.

Thanks,

Tom
>
2. "/myimage.gif" works simply because you have same folders/files in
www.stf.com as in www.stf.com/stage

the page in www.stf.com/stage that references a /myimage.gif is actually
referencing www.stf.com/myimage.gif and not www.stf.com/stage/myimage.gif

When you prefix path with / (like myimage.gif) it's called absolute path.
Browser automaticly adds server name to get full URL.
When you do not have / (like ../../myimage.gif) then it's called relative
path and browser automaticly appends the path of the current page to it.
It has nothing to do with ASP.NET. It's how browser works. If you using ~
in ASP.NET then ASP.NET engine converts ~ to absolute path and appends
current application folder. So if you look at the HTML source you will not
see ~ you will see /stage/

Example: if you page's url is http://www.stf.com/stage/folder1/mypage.aspx
and that page had an <img src="../../myimge.gif">
then you actually refer to
http://www.stf.com/stage/folder1/../..myimage.gif" wich in turn is
http://www.stf.com/myimage.gif
if that page had an <img src="/myimage.gif" then it refers to
http://www.stf.com/myimage.gif
if that page had an <img src="myimage.gif" then it refers to
http://www.stf.com/stage/folder1/myimage.gif
George.



"tshad" <t@home.comwrote in message
news:uB**************@TK2MSFTNGP05.phx.gbl...
>"George Ter-Saakov" <gt****@cardone.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
>>1. web.config files are inheritable.
So in your case when you have www.stf.com/stage/ ASP.NET takes
web.config from www.stf.com folder and merges it with www.stf.com/stage/
folder. That is why you get an error "The module 'ScollKeeperModule' is
already in the application and cannot be added again"
Then is there no way to do this?

I need to have ScrollKeeper in my system but I need to call it both ways:
as a website (www.stfstage.com) and as a virtual directory
(www.stf.com/stage).

Also, I don't have a problem with any of the other entries in the
web.config files, such as the appSettings:

<appSettings>
<add key="ConnectionString" value="Persist Security Info=False;Data
Source=xx;Initial Catalog=yy;User ID=zz;Password=ff;"/>
</appSettings>

In my case, I have a different database for my live application and one
for my development site. In this case, which one would it use? The one
from www.stf.com or the one from the www.stf.com/stage folder?
>>2. When you go by www.stf.com/stage/ your root is considered to be
www.stf.com and /stage/ is subfolder. so when you refer to your controls
as '/skins/mth/MainPage.ascx' you actually refer to
www.stf.com/skins/mth/MainPage.ascx which is another application and you
can not do that. And ASP.NET pollitely tells you about it.

You should use ~/ so it will be '~/skins/mth/MainPage.ascx'. ~ symbol
means in root of application. So in your case the ASP.NET will translate
it as www.stf.com/stage/skins/mth/MainPage.ascx

You can use ~ anywere in a code that processed by ASP.NET
Example:
<img src="~/myimge.gif"-- will not work. The ASP.NET does not parse
plain HTML.
<img src="~/myimge.gif" runat=server--will work correctly. ASP.NET
parses out any tag that marked as runat=server.

That seems to work as you say.

I did do a trace on this page and here is what it is showing:

PATH_INFO /stage/JobSeeker/displayCompanyJobs.aspx
PATH_TRANSLATED
C:\Inetpub\wwwroot\StfStage\JobSeeker\displayComp anyJobs.aspx

So the system knows what the path is so I am not sure why I need the "~"
but it does work. As you say if I do:

<img src="~/myimge.gif">

It doesn't work and shows as a broken gif. But

<img src="/myimge.gif">

does seem to work and knows to look at the root of the Application. I
would have thought that .net objects would do the same (would have been
more consistent). I would have thought that you would use the "~" for
the exceptions. Oh well.

The other thing that doesn't seem to work is:

<img src="../../myimge.gif">

Which works fine if I call it from www.stfstage.com but why wouldn't it
work here? It has nothing to do with the root of the Application.

Thanks,

Tom
>>>

George.



Aug 23 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Daniel | last post: by
2 posts views Thread by Danny Miller | last post: by
2 posts views Thread by Jozef | last post: by
4 posts views Thread by Just D. | last post: by
9 posts views Thread by antonyliu2002 | last post: by
2 posts views Thread by tshad | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.