Note that there are some explanatory texts on larger screens.

plurals
  1. POForms authentication, ASP.NET MVC and WCF RESTful service
    primarykey
    data
    text
    <p>One test webserver, with the following applications</p> <p><strong>service.ganymedes.com:8008</strong> - WCF RESTful service, basically the FormsAuth sample from WCF Starter Kit Preview 2</p> <p><strong>mvc.ganymedes.com:8008</strong> - ASP.NET MVC 2.0 application</p> <p>web.config for service.ganymedes.com:</p> <pre><code>&lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/login.aspx" timeout="2880" domain="ganymedes.com" name="GANYMEDES_COOKIE" path="/" /&gt; &lt;/authentication&gt; </code></pre> <p>web.config for mvc.ganymedes.com:</p> <pre><code>&lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/Account/LogOn" timeout="2880" domain="ganymedes.com" name="GANYMEDES_COOKIE" path="/" /&gt; &lt;/authentication&gt; </code></pre> <p>Trying my darndest, a GET (or POST for that matter) via jQuery's $.ajax or getJson does not send my cookie (according to Firebug), so I get HTTP 302 returned from the WCF service:</p> <pre><code>Request Headers Host service.ganymedes.com:8008 User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729) Accept application/json, text/javascript, */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://mvc.ganymedes.com:8008/Test Origin http://mvc.ganymedes.com:8008 </code></pre> <p>It's sent when mucking about on the MVC site though:</p> <pre><code>Request Headers Host mvc.ganymedes.com:8008 User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://mvc.ganymedes.com:8008/Test Cookie GANYMEDES_COOKIE=0106A4A666C8C615FBFA9811E9A6C5219C277D625C04E54122D881A601CD0E00C10AF481CB21FAED544FAF4E9B50C59CDE2385644BBF01DDD4F211FE7EE8FAC2; GANYMEDES_COOKIE=D6569887B7C5B67EFE09079DD59A07A98311D7879817C382D79947AE62B5508008C2B2D2112DCFCE5B8D4C61D45A109E61BBA637FD30315C2D8353E8DDFD4309 </code></pre> <p>I also put the exact same settings in both applications' web.config files (self-generated validationKey and decryptionKey).</p> <p>On WCF binding config, the FormsAuth example doesn't have an explicit <code>&lt;bindings&gt;</code> element, but I've added this:</p> <pre><code>&lt;system.serviceModel&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"&gt; &lt;baseAddressPrefixFilters&gt; &lt;add prefix="http://service.ganymedes.com:8008" /&gt; &lt;/baseAddressPrefixFilters&gt; &lt;/serviceHostingEnvironment&gt; &lt;/system.serviceModel&gt; </code></pre> <p>or the service wouldn't bind at all. I can use the same data URI as I use in the jQuery call directly in the browser, it'll send the cookie and WCF will return data. I just can't seem to use it in a cross sub-domain call and include the auth cookie.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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