Blocking all the pages except Specific page in a Web Site [Answered]RSS

4 replies

Last post May 29, 2020 08:55 AM by Jalpa Panchal

  • Blocking all the pages except Specific page in a Web Site

    May 28, 2020 08:44 PM|mashokan|LINK

    We have One web site running in IIS, which is accessible with following 2 urls

    1.https://preventive-dev.corp.com

    2.https://corrective-dev.corp.com

    The second url is used to allow guest users to submit request.

    We have one scenario to block all the url except https://corrective-dev.corp.com/cbs/go.aspx?u=/ims/zIncok page. 

    Since the application is integrated with SSO, the business team don't want to expose remaining pages to be accessible to other users available in LDAP.

    I try with URL Rewrite > Request Blocking

    While doing this not able to validate url host name and query string.. 

    Is there any other way that we can block all the pages by validating Hostname and Query string ?

    Thanks.

    Ashok

  • Re: Blocking all the pages except Specific page in a Web Site

    May 29, 2020 02:15 AM|lextm|LINK

    mashokan

    While doing this not able to validate url host name and query string.. 

    That wizard only guided you to create a very basic rule, but in fact the rule can be extended to be much more powerful (with conditions and so on). Microsoft has some documentation like https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#rewrite-rules-overview

    But you can study how others are using various conditions over the internet.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Blocking all the pages except Specific page in a Web Site

    May 29, 2020 03:29 AM|Jalpa Panchal|LINK

    hi,

    You could use iis URL rewrite rule with different conditions. below is rule based on your requirement:

    <rule name="blocking rule 1" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{URL}" pattern="(.*)" />
                            <add input="{HTTP_HOST}" pattern="corrective-dev.corp.com" negate="true" />
                            <add input="{REQUEST_URI}" pattern="/cbs/go.aspx" negate="true" />
                            <add input="{HTTPS}" pattern="on" negate="true" />
                            <add input="{QUERY_STRING}" pattern="u=/ims/zIncok" negate="true" />
                        </conditions>
                        <action type="AbortRequest" />
                    </rule>

    which allows only this https://corrective-dev.corp.com/cbs/go.aspx?u=/ims/zIncok  url and index page of the site. Users can not access other pages or folders.

    Regards,

    Jalpa

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Blocking all the pages except Specific page in a Web Site

    May 29, 2020 08:45 AM|mashokan|LINK

    Thanks, Jalpa and Lex. It really helps me to fix this access restrictions.

  • Re: Blocking all the pages except Specific page in a Web Site

    May 29, 2020 08:55 AM|Jalpa Panchal|LINK

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Jalpa.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.