views:

144

answers:

1

Hi,

I am trying to authenticate with the sharepoint authenticate web service in an account I have. I get an error saying NotInFormsAuthenticationMode.

How do I change it from forms to none or windows?

I tried with: myReference.Authentication auth = new myReference.Authentication(); myReference.AuthenticationMode = myReference.AuthenticationMode.None;

but it says myReference.AuthenticationMode is a type. which is not valid in the given context.

Suggestions?

Any help is appreciated.

A: 

Your sharepoint server needs to be modified...

See steps 5, 6 and 7 here: simple-talk.com/dotnet/windows-forms/configuring-forms-authentication-in-sharepoint-2007/

This is all done in central administration.

Normally in other asp.net applications you would do this through the web.config to look something like this:

<!-- Web.config file -->
<system.web>
   <authentication mode="Forms">
      <forms forms="401kApp" loginUrl="/login.aspx" />
   </authentication>
</system.web>

Edit: Alright, if you cant change windows authentication then you need to change the way you're authenticating. If impersonate is enabled in the authentication of the sharepoint site than you can programatically impersonate a user.

See http://msdn.microsoft.com/en-us/library/ms998351.aspx ("Impersonating by using LogonUser")

James Santiago
I don't have access to the sharepoint server.So if I get error NotInFormsAuthenticationMode I can't alter my code and access in any other way?
peter
I thought I could use something like http://msdn.microsoft.com/en-us/library/system.web.configuration.authenticationmodebut I don't get it to work
peter