Results 1 to 6 of 6

Thread: IIS7 web.config custom error page?

  1. #1
    Join Date
    May 2010

    IIS7 web.config custom error page?


    I'm used to working on a Apache2 server where I could use htaccess to set up things such as custom error pages and am trying to apply the same practice with a web.config file on IIS7.

    I think the problem is my lack of understanding of IIS7 setup in general. I have a server set up using php5 and everything is working fine. When on apache dev server I would have something like www.mydomain.com/testsites/site1 and then site2, site3... and so on. And I would just drop a htaccess file in the root of the site in question.

    The "default site" in IIS7 is what complicates things for me. I have gone and dropped all my test sites into the root of www which is accessed by the default site however even if I set custome error pages up in "site1" through IIS manager I still get the IIS7 error pages. Do I have to use the manager and create a different site bound to a different port for every test site or can I just put everything in the www directory this way?

    I've found many articles through google but the terminology is beyond my current comprehension as all the solutions revolve around asp.net, dotnet3.5, asp, aspx, etc.

    So I'm wondering can someone tell me as if I was totally new, what, where, and how, do I need to do/change besides putting my web.config file in the root of site1 to keep IIS7 from overriding the custom errors setup I have in my web.config.

    Thanks to anyone who doesnt' mind taking the time to walk me through this in steps.

    By the way, I got this from one of the articles and modified it to the actual path of my error page and then put it in the root of site1 with the "error_pages" directory.
    <customErrors mode="On" defaultRedirect="/error_pages/404_page_not_found.html">
        <error statusCode="404" redirect="/error_pages/404_page_not_found.html"/>
    Thanks :-)

  2. #2
    Join Date
    May 2010
    I tried creating a virtual directory pointing to site1 and then set the error page settings in IIS manager and it changed my web.config file to this

            <add key="customeErrors" value="/error_pages/" />
                <remove statusCode="404" subStatusCode="-1" />
                <error statusCode="404" prefixLanguageFilePath="" path="/error_pages/404_page_not_found.html" responseMode="ExecuteURL" />
    but it still is using the default IIS 404 page

  3. #3
    Join Date
    Mar 2011
    You might have to put the drive letter in the path...

  4. #4
    Join Date
    May 2010
    Thanks for the suggestion Zeldaboy, but I tried ralative, absolute, and external url in the path and neither of them work. I've read where others have problems with this not working with IIS7 and in some cases IIS6 and apparently there is some over-complicated process because both IIS and the .net framework are involved but I haven't found a step by step how-to yet.

    Rather than guessing since that's what I've been doing for 2 days I'm hoping to find someone who has successfully done this to break down the steps including any server config that may be required. (As if I just installed IIS7 and am working on my first site).

  5. #5
    Join Date
    May 2010
    The more I read the more confused I am. Is creating a new site instead of the default site required? Does it have to be an application? Do I have to package a site? iis.net is talking some crazy stuff compared to Apache.

    Maybe this is all required to be able to use a web.config file? I did manage to get it to give me an error about the config file at one point last night which means is is recognizing the existence of the web.config file in the site root.

    I found out earlier the httpErrors defaultPath attrib was locked in the IIS configuration editor but it would only allow me the "lock" option. I fixed that by deleting the defaultPath attrib manually from the applicationhost.config file and was then able to set feature properties to "custom" and set the path to the error page. But now it just goes to googles oops page and doesn't even show the IIS7 404 page.

  6. #6
    Join Date
    Jan 2008

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.09870 seconds
  • Memory Usage 2,893KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates