473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Virtual directory woes

Hi all,

Using C# .NET 1.1

I am creating a CMS type of application. So far so good. I have a templating
system in place that works fantastically. I can remap non-real files and
folders and get the CMS system to handle it. This is working quite cool.

I have a 404 handler in place which helps to manage the non-real files and
folders. This is done at IIS level rather than .NET level. There is a reason
for this, but that is of no consequence to my problem, but it is worth
mentioning.

In IIS, I have changed the default document to call default.aspx and removed
all others. The idea being that the .NET processor should get called when I
go into the cms folder...

such like...
http://localhost/cms-folder (note, cms-folder is the virtual directory
mapped to a real directory)

should call (due to IIS configuration)
http://localhost/cms-folder/default.aspx

However, I don't want to have to have a default.aspx. The CMS should handle
it like it does with subfolders. If I was to call for example
http://localhost/cms-folder/subfolder then my CMS picks up on this and
handles it correctly (using the 404 handler). However, if I just do
http://localhost/cms-folder the .NET process is not even called, even though
my default file is a .aspx page (even though it is non-existant)

I currently get "Directory Listing Denied" and a 403 error in my log files.
Do I need to map the 403:14 custom error in IIS to my ASPX processor?

I will be unable to create any ISAPIs as the destination of this project
will be on a shared host, where they do not allow ISAPIs to be installed,
however, I can get certain other configuration changes within IIS done if I
need them.

How can I get this to work?

Thanks.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Mar 29 '07 #1
6 3304
On Mar 29, 12:00 pm, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
Hi all,

Using C# .NET 1.1

I am creating a CMS type of application. So far so good. I have a templating
system in place that works fantastically. I can remap non-real files and
folders and get the CMS system to handle it. This is working quite cool.

I have a 404 handler in place which helps to manage the non-real files and
folders. This is done at IIS level rather than .NET level. There is a reason
for this, but that is of no consequence to my problem, but it is worth
mentioning.

In IIS, I have changed the default document to call default.aspx and removed
all others. The idea being that the .NET processor should get called when I
go into the cms folder...

such like...http://localhost/cms-folder(note, cms-folder is the virtual directory
mapped to a real directory)

should call (due to IIS configuration)http://localhost/cms-folder/default.aspx

However, I don't want to have to have a default.aspx. The CMS should handle
it like it does with subfolders. If I was to call for examplehttp://localhost/cms-folder/subfolderthen my CMS picks up on this and
handles it correctly (using the 404 handler). However, if I just dohttp://localhost/cms-folderthe .NET process is not even called, even though
my default file is a .aspx page (even though it is non-existant)

I currently get "Directory Listing Denied" and a 403 error in my log files.
Do I need to map the 403:14 custom error in IIS to my ASPX processor?

I will be unable to create any ISAPIs as the destination of this project
will be on a shared host, where they do not allow ISAPIs to be installed,
however, I can get certain other configuration changes within IIS done if I
need them.

How can I get this to work?

Thanks.
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com- Local franchises available
Either you should add a custom handler for the 403-error

<error statusCode="403" redirect="/redirect.aspx" />
<error statusCode="404" redirect="/redirect.aspx" />

or consider the URL Rewriting (but in your case, you need to be able
to change IIS to pass all requests through to the ASP.NET - not sure
if you can do it on a shared host)

Mar 29 '07 #2
Thanks... but I don't think the error handlers would get called as it
doesn't even appear to be calling the .NET process.

I already have URL-Rewriting in place and that works great.

I can get certain configurations changed in IIS on the shared host that I
need, for example, I can get .html mapped to .net, I can get 404 mapped to a
404 handler, but I cannot get isapi controls installed.

If I need to make a change to IIS, what would I need to do? I will have a go
at changing my 403:14 error code on my local machine to see what happens,
but I would have thought that at least making the default page a .NET page
would have kick started the .NET process.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Either you should add a custom handler for the 403-error

<error statusCode="403" redirect="/redirect.aspx" />
<error statusCode="404" redirect="/redirect.aspx" />

or consider the URL Rewriting (but in your case, you need to be able
to change IIS to pass all requests through to the ASP.NET - not sure
if you can do it on a shared host)

Mar 29 '07 #3
On Mar 29, 12:52 pm, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
Thanks... but I don't think the error handlers would get called as it
doesn't even appear to be calling the .NET process.
I didn't try it with 403, and according to Microsoft it should work
http://samples.gotdotnet.com/quickst...dlingerrs.aspx

I already have URL-Rewriting in place and that works great.
This is not the URL-Rewriting I meant

Look at the following article
http://msdn2.microsoft.com/en-us/library/ms972974.aspx

Mar 29 '07 #4
Changing the 403:14 to any .aspx page seems to handle it.

However, with a combination of 403 to redirect to a non-existant page and a
404 to handle non-existant pages (which works as I can see), I get in my log
files...

2007-03-29 11:10:38 127.0.0.1 - W3SVC1 DAVID 127.0.0.1 80 GET
/cms/default.aspx 403;http://localhost/cms/ 200 0 4176 284

(line edited for brevity)

As you can see, default.aspx causes a 403, which causes a 404, which looks
like it ultimately ends in a 200 being sent to the browser. Will a search
engine like google be able to pick up on the hack and drop the listings? (It
is not a hack to fool the search engine. It is purely so that the CMS will
work without having to install isapi's on the shared host)

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:ez**************@TK2MSFTNGP06.phx.gbl...
Thanks... but I don't think the error handlers would get called as it
doesn't even appear to be calling the .NET process.

I already have URL-Rewriting in place and that works great.

I can get certain configurations changed in IIS on the shared host that I
need, for example, I can get .html mapped to .net, I can get 404 mapped to
a 404 handler, but I cannot get isapi controls installed.

If I need to make a change to IIS, what would I need to do? I will have a
go at changing my 403:14 error code on my local machine to see what
happens, but I would have thought that at least making the default page a
.NET page would have kick started the .NET process.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
>Either you should add a custom handler for the 403-error

<error statusCode="403" redirect="/redirect.aspx" />
<error statusCode="404" redirect="/redirect.aspx" />

or consider the URL Rewriting (but in your case, you need to be able
to change IIS to pass all requests through to the ASP.NET - not sure
if you can do it on a shared host)


Mar 29 '07 #5
Looking at that page, the 403 that I was experiencing wasn't even getting to
the .net handler, so the sample on gotdotnet will not work for that
situation. I had to change IIS 403:14 handler to specifically call a .aspx
page to get it into the .net handler. The situation of this problem is
that...

1. A real directory is mapped as the virtual directory in the IIS. The IIS
has default page set to .NET page that doesn't actually exist. The .NET
handler should be called but isn't.
2. With URL rewriting and 404 handling, I can have non-existant sub folders
under the real directory. This works brilliantly. I can do calls like
http://localhost/cms/not-real-directory and get a return, even though I am
not calling a .NET page. I would have thought with the same configuration,
the non-existing default page would have worked.
3. the non-existing default.aspx page in the root doesn't even fire the .net
handler. It just returns a directory access forbidden error, which is a 403
(specifically, 403:14).
4. Had to trap that in IIS to point to a non-existing aspx page (which
should have been handled in what I did in step 1, but didn't work).
The URL rewriting article is similar to what I am doing. I have hackable
URLs which I am handling a different way.

All is working now. Maybe not the best way, but it works.

Thanks.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
On Mar 29, 12:52 pm, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
>Thanks... but I don't think the error handlers would get called as it
doesn't even appear to be calling the .NET process.

I didn't try it with 403, and according to Microsoft it should work
http://samples.gotdotnet.com/quickst...dlingerrs.aspx

>I already have URL-Rewriting in place and that works great.

This is not the URL-Rewriting I meant

Look at the following article
http://msdn2.microsoft.com/en-us/library/ms972974.aspx

Mar 29 '07 #6
On Mar 29, 1:19 pm, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
As you can see, default.aspx causes a 403, which causes a 404, which looks
like it ultimately ends in a 200 being sent to the browser. Will a search
engine like google be able to pick up on the hack and drop the listings? (It
is not a hack to fool the search engine. It is purely so that the CMS will
work without having to install isapi's on the shared host)
I'm not sure how you do that (what means the "404 handler"?), but it
seems that the client receives 200 response header only. Otherwise,
you would get 403-error in your browser.

To check the response headers I'm using FireFox with an additional
plug-in (Web-developer Toolbar)

Mar 29 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Zenobia | last post by:
I copy an application to wwwroot: wwwroot +--- myApp +--- common | +--- images | default.asp global.asa
2
by: Jeffry van de Vuurst | last post by:
Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of you has some ideas about this. I'm using the...
4
by: Michelle | last post by:
I have a website with 6 virtual directories under it who dont "see" the bin/ directory in the root. If I create a /bin directory in each virtual directory and then copy my dll's in there, it...
5
by: Leszek | last post by:
Hello, Could anybody explain what's a difference between a virtual directory and an application root under IIS? I'm a little bit confused. This is mu problem: Let's assume the following...
10
by: Wm. Scott Miller | last post by:
We have a intranet site that allows one of our departments to search a set of pdfs and then look at them. Only problem is that only they and us geeks should be allowed to see the pdfs. We have it...
2
by: Danny Miller | last post by:
Hi there, I'm facing a problem that is driving me nuts. The scenario is as follows: 1) Create an empty directory structure e.g. C:\Dev1\TestWebApp 2) Map a virtual directory e.g. TestWebApp...
4
by: david | last post by:
I basically use the following code to display the directory and file names in the WWWROOT, but can not show the virtual directory. ---- Dim path As String = Server.MapPath(x) Dim di As...
6
by: ManagedCoder | last post by:
Hi, My requirement is as follows: I need to set the HttpExpires (enable content expiration - set to 7 days) on a folder within a virtual directory. I have been able to set the HttpExpires...
6
by: Scott M. | last post by:
I didn't get a resolution to this in my earlier post, so I'll try again: System: Windows XP Pro. (SP2) with IIS installed and running PRIOR to VS 2008 Pro. installation. VS 2008 Pro. (full...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.