Home > Ria Services, Silverlight, WCF > RiaContext.Current.Authentication.User is NULL.

RiaContext.Current.Authentication.User is NULL.

From last two days i was looking for the issue “RiaContext.Current.Authentication.User is null” while authenticating user.

The simple code is shown below which works fine on local development server.

private AuthenticationService _userService = RiaContext.Current.Authentication;
_userService.Login(“test”,”test@123″);
_userService.User.Identity.IsAuthenticated always returns False.

After debugging the above on the production server “RiaContext.Current.Authentication.User” returns Null.

Then i use fiddler which gave me following error:

The resource cannot be found.

http://mydomainname.com/ClientBin/DataService.axd/MyAPP-Web-MyDomainService/GetUser.

HTTP 404 : The resource cannot be found.

There are many reasons for the above error:

1.Your application should run in Full Trust Mode.

<system.web>

<trust level=”Full” />

</system.web>

2.Make sure that your web.config contains the following entries:

<handlers>
<add name=”DataService” verb=”GET,POST” path=”DataService.axd” type=”System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ />
</handlers>

<httpHandlers>
<add path=”DataService.axd” verb=”GET,POST” type=”System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ validate=”false” />
</httpHandlers>

3.Above can also happen due to missing assembly reference so make sure that you have all the assemblies installed.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.