Thursday, March 24, 2011

Password protecting ATOM feeds

The Twitter ATOM feed requires your login and password (obviously), which is nicely supported by IE7 (apparently IE7 can't handle RSS feeds with login/pw). IE displays a simple login prompt when you register the feed.

How do I implement something similar in ASP.NET without access to the server or IIS?

From stackoverflow
  • You could send a header manually with some basic ASP to request generic http authentication.

    <% authUser = TRIM( Request.ServerVariables( "AUTH_USER" ) ) IF authUser = "" THEN Response.Status = "401 Not Authorized" Response.AddHeader "WWW-Authenticate", "Basic Realm=""SUPEREXPERT""" Response.End END IF %>

    ( Copied from: http://psacake.com/web/fl.asp )

    You could also define authentication settings in your web.config if you're using asp.net

    <!-- Web.config file --> <system.web> <authentication mode="basic" /> </system.web>

    Jakob Gade : Wouldn't that solution ( in web.config) require that I have permission to create users on the server? The solution is going to be hosted somewhere, where I probably can't create Windows accounts on the server.
    Bob Aman : Sure, but the first half of his solution will still work.

0 comments:

Post a Comment