SetPassword for iMIS 15 Web Service

I keep recieving this error when trying to set a password for a user through the web service;
"Server was unable to process request. ---> You must authenticate with the web service before you can set a user's password."

Below is the code I am trying to execute in visual studios;

Dim _iMISAuth As imis15.MembershipWebService = New imis15.MembershipWebService

Dim _strNewPassword As String = _iMISAuth.GeneratePassword
Dim _bolSetPassword As Boolean = False

If _iMISAuth.LoginUser("manager", "manager", True) = imis15.LogonResultCodes.Succeeded Then
_bolSetPassword = _iMISAuth.SetUserPassword(username, _strNewPassword)
End If

I don't have the membershp provider in the web.conf but I am calling the webservice and trying to authenticate that way according to http://www.imiscommunity.com/use_the_membership_web_service. I have tried different ways to authenticate before attemppting change the password. I do realize that there is a resetPassword but I can not use it for various reasons. This seems simple but I am just stuck . Any help would greatly be appreciated.
- Adam

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Adam, by default the web

Adam, by default the web service proxy generated by Visual Studio doesn't support cookies; you'll need to add the following line right after the line where you create the new MembershipWebService object:

_iMISAuth.CookieContainer = New System.Net.CookieContainer

That will ensure that the login information gets sent back with the call to SetUserPassword.

That was it. Thank you. My

That was it. Thank you. My next question would be I am trying to get the SetPassword function from sending an email with the update, is that possible?

Adam

Do you mean you want to

Do you mean you want to prevent it from sending the update? If so, I think someone posted that the only way to do that is to put an invalid e-mail address (i.e. something that's not an e-mail address at all) in the "from" value in this portion of the web.config file for the site:

	<system.net>
		<mailSettings>
			<smtp deliveryMethod="network" from="imis@advsol.com">
				<network host="onrsmtp.asi.local" port="25" defaultCredentials="true"/>
			</smtp>
		</mailSettings>
	</system.net>

Doing that breaks the web

Doing that breaks the web service;

Server Error in '/WEBApp' Application.
--------------------------------------------------------------------------------

Server was unable to process request. ---> The specified string is not in the form required for an e-mail address.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> The specified string is not in the form required for an e-mail address.

Source Error:

Line 1712: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://imis.com/webservices/membership/SetUserPassword", RequestNamespace="http://imis.com/webservices/membership", ResponseNamespace="http://imis.com/webservices/membership", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 1713: public bool SetUserPassword(string username, string newPassword) {
Line 1714: object[] results = this.Invoke("SetUserPassword", new object[] {
Line 1715: username,
Line 1716: newPassword});

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\naca\0a85fcc3\50c0e5d4\App_WebReferences.7yqjkkav.0.cs Line: 1714

Also would that not break event confirmations?

- adam

Ah, I found it -- see the

It says "You are not

It says "You are not authorized to access this page". I know, what a pain I am, but thank you for all the help.

Adam

Quoted comment

"A hack to make the emails not send out.
On April 21st, 2008 MacM says:
I do have a small hack that will allow you to bypass the auto emails from the webservice.

Change the LogonChangesEmailFrom value to non valid email address.
Note!! Do not try and leave it empty (it will default to imis@advsol.com)

This should stop the email from getting out of the SMTP. Hopefully the webservices will come with a "Email" option / parameter in the future.

Mac M.
Technology Services Company (TSC Inc.)
www.tscinc.com"

Thank you. That did the

Thank you. That did the trick.

Adam