Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET Web Service inside Forms Authentication Application
    primarykey
    data
    text
    <p>I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is deployed in multiple instances (e.g., customer1, customer2, test, dev, etc...), with a separate database per instance. SSL is in play. Instance configuration is via an XML config file.</p> <p>I have a new requirement to allow upload/download of certain data, which I would like to implement as a public web service.</p> <p>My initial thought here was to selectively disable forms authentication for a subdirectory of the application (e.g., ~/Services), and then do authentication via a SOAP header or similar.</p> <p>However, I'm not finding a way to selectively disable forms auth.</p> <p>Question: Is there a way to do this? I've tried the &lt;location&gt; tag in web config to no avail.</p> <p>If not, what are your recommendations for how to set this up? I can think of the following options:</p> <p>1) Create a new "Services" project in my solution, and then configure a separate IIS ASP.NET application on that directory in each instance. (Pro: easy access to instance configuration, which may be needed in the future. Con: configuration burden for each relevant instance).</p> <p>2) Create a separate "Services" solution that references needed assemblies from the application solution and host it as a separate ASP.NET application. Then, lookup the db connection string based on the UserName provided in SOAP Header. (Pro: single app to configure in IIS. Con: No easy access to instance config.)</p> <p>3) ??</p> <p>Clarification: I did see the answer here: <a href="https://stackoverflow.com/questions/941909/override-asp-net-forms-authentication-for-a-single-page/941923#941923">Override ASP.NET forms authentication for a single page</a>, but the use of a location tag is not helping (requests for the web service are still redirected). The relevant sections in my web.config look like this:</p> <pre><code>&lt;system.web&gt; &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="Login.aspx"/&gt; &lt;/authentication&gt; &lt;authorization&gt; &lt;deny users="?"/&gt; &lt;allow users="*"/&gt; &lt;/authorization&gt; &lt;/system.web&gt; &lt;location path="~/Services/MyService.asmx"&gt; &lt;system.web&gt; &lt;authentication mode="None" /&gt; &lt;authorization&gt; &lt;allow users="*" /&gt; &lt;/authorization&gt; &lt;/system.web&gt; &lt;/location&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload