1

I come into a difficult situation. We have a SharePoint 2016 on-premise farm with URL https://sharepoint.com

Due to restriction on our network, we have to setup an ASP.NET application under it with URL https://sharepoint.com/testsite/ and allow anonymous access.

I test setup a virtual directory "testsite" under https://sharepoint.com. In the virtual directory > Authentication > Anonymous Authentication (Enabled) > I have tried setup a specific user or application pool identity. Both do not work as expected. In both settings, password box is prompted and I need to login with SharePoint admin in order to access https://sharepoint.com/testsite/

Anyone have experience for this situation?

5
  • Seems like you have authorization problems with sharepoint. Check sharepoint security settings. There should be a list of addresses you can "set public" or put the url on "ignore list" for security. As in, tell sharepoint "this address is public but it is not part of any site collection". I don't have time to give you detailed answer with proper screenshots and all, but I am interested in how you solve it. Basically, IIS for sharepoint as a whole requires authorization by default, you need to tell it to ignore what sharepoint considers a subsite...
    – jo1storm
    Sep 21 at 9:55
  • @jo1storm I have no clue on "set public" and "ignore list" feature. Could you give me some more hints?
    – Mark L
    Sep 23 at 1:41
  • Maybe this might help. In short, IIS rules for sharepoint are stronger than any rule for subsite in that same folder. You'll need to exclude any folder from those rules. Including security and authorization rules. Similar principle to this. stackoverflow.com/questions/38880002/…
    – jo1storm
    Sep 23 at 7:09
  • @jo1storm the answer by Kent Lynch have solved my problem: stackoverflow.com/questions/1648419/…
    – Mark L
    Sep 23 at 9:14
  • Ok, post it as an answer then accept it.
    – jo1storm
    Sep 23 at 9:32
0

I solved the problem by this answer in stackoverflow, provided by Kent Lynch. I copy & paste the answer to here for future reference:

You need to create an sub-directory that acts as a buffer to block/remove the inherited items from the .net 2 / 3.5 framework and then create your application under this.

Assuming you name the buffer application apps, and your custom .NET 4.0 application is called myapp, your resulting application would reside at:

http://[sharepoint-site]/apps/myapp/

How to do this:

  1. Create a sub-directory apps under the root of your SharePoint site

  2. Go into security for the apps directory and add everyone with Read permissions

  3. In IIS, convert this to an application and pick the same app-pool that your SharePoint site is running under

  4. Create a web.config under /apps/, this will block/remove the SharePoint stuff (see below for the code block)

<configuration>
  <system.web>
    <httpHandlers>
      <remove path="Reserved.ReportViewerWebControl.axd" verb="*" />
    </httpHandlers>
    <httpModules>
      <clear/>
    </httpModules>
    <webParts>
      <transformers>
        <clear />
      </transformers>
    </webParts>
  </system.web>

  <system.webServer>
    <handlers>
      <remove name="OwssvrHandler" />
      <remove name="ScriptHandlerFactory" />
      <remove name="svc-Integrated" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />
      <remove name="JSONHandlerFactory" />
      <remove name="ReportViewerWebPart" />
      <remove name="ReportViewerWebControl" />
    </handlers>
    <modules>
      <!-- depending on any customizations, you may have to add/remove items from this list as needed -->
      <remove name="SPRequestModule" />
      <remove name="ScriptModule" />
      <remove name="SharePoint14Module" />
      <remove name="StateServiceModule" />
      <remove name="PublishingHttpModule" />
      <remove name="RSRedirectModule" />
    </modules>
    <httpErrors errorMode="Detailed"></httpErrors>
  </system.webServer>
</configuration>
  1. Create your myapp directory under apps (ex. /apps/myapp/)
  2. In IIS, go into Application Pools, create a new AppPool, MyApp .NET v4.0
  3. Go into Advanced Settings > Identity and add the same AD domain user account credentials that your SharePoint site is using
  4. Still in IIS, go back to myapp and convert to an application and pick the MyApp .NET v4.0 AppPool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.