Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 23, 2013 01:53 AM by Pengzhen Song - MSFT
Member
8 Points
12 Posts
Jan 21, 2013 03:35 PM|LINK
Hi
I have managed to follow this tutorial and got the application working witha winforms app.
http://www.codeproject.com/Articles/380900/WCF-Authentication-and-Authorization-in-Enterprise
I need to amend the solution to work with both asp.Net forms and Jquery direct connections.
I am having problems authenticating when using Jquery directly. using the following code:
$(document).ready(function () { var Username = ""; var Password = ""; $("#btnSubmit").click(function () { Username = $('#txtUserName').val(); Password = $('#txtPassword').val(); var ssa = Sys.Services.AuthenticationService; ssa.set_path("./AuthenticationService.svc"); Sys.Services.AuthenticationService.login(Username, Password, false, null, 'AuthenticationService.svc/login', CompleteCallBack, null, Username); }); });
I beleive the problem is lack of endpoints in the web.config,
?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Forms"> <forms slidingExpiration="true" name="AuthCookie" protection="All" timeout="20"/> </authentication> <machineKey decryption="AES" validation="SHA1" decryptionKey="24C155D64F9EB4F300C1BDFA624E2B3765CBBCF64C47B105" validationKey="33CBA563F26041EE5B5FE9581076C40618DCC1218F5F447634EDE8624508A129" /> </system.web> <system.web.extensions> <scripting> <webServices> <authenticationService enabled="true"/> </webServices> </scripting> </system.web.extensions> <system.serviceModel> <services> <service name="EntityGateway.UtilityService" behaviorConfiguration="InterceptorBehavior"> </service > </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> <behavior name="InterceptorBehavior"> <interceptorBehaviorExtension /> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <extensions> <behaviorExtensions> <add name="interceptorBehaviorExtension" type="EntityGateway.InterceptorBehaviorExtension, EntityGateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> </behaviorExtensions> </extensions> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
I am using an Inerceptor to validate the incoming request and unsure how to add the endpoints. the test page I am adding is currently within the same site so it cannot be a crossdomain problem.
Any help would be appreciated.
regards
Tom
Star
8276 Points
848 Posts
Microsoft
Jan 23, 2013 01:53 AM|LINK
Hi, I think you can add the endpoint like this <services> <service name="EntityGateway.UtilityService" behaviorConfiguration="InterceptorBehavior"> <endpoint/> </service > </services>
I think you can add the endpoint like this
You can refer this
http://weblogs.asp.net/paolopia/archive/2007/08/23/writing-a-wcf-message-inspector.aspx
http://forums.asp.net/t/1764158.aspx/1
And I think you can post the thread to wcf forum where you can get more professional information.
Hope it can help you.
tomkett
Member
8 Points
12 Posts
WCF ENDPOINTS?
Jan 21, 2013 03:35 PM|LINK
Hi
I have managed to follow this tutorial and got the application working witha winforms app.
http://www.codeproject.com/Articles/380900/WCF-Authentication-and-Authorization-in-Enterprise
I need to amend the solution to work with both asp.Net forms and Jquery direct connections.
I am having problems authenticating when using Jquery directly. using the following code:
$(document).ready(function () { var Username = ""; var Password = ""; $("#btnSubmit").click(function () { Username = $('#txtUserName').val(); Password = $('#txtPassword').val(); var ssa = Sys.Services.AuthenticationService; ssa.set_path("./AuthenticationService.svc"); Sys.Services.AuthenticationService.login(Username, Password, false, null, 'AuthenticationService.svc/login', CompleteCallBack, null, Username); }); });I beleive the problem is lack of endpoints in the web.config,
?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Forms"> <forms slidingExpiration="true" name="AuthCookie" protection="All" timeout="20"/> </authentication> <machineKey decryption="AES" validation="SHA1" decryptionKey="24C155D64F9EB4F300C1BDFA624E2B3765CBBCF64C47B105" validationKey="33CBA563F26041EE5B5FE9581076C40618DCC1218F5F447634EDE8624508A129" /> </system.web> <system.web.extensions> <scripting> <webServices> <authenticationService enabled="true"/> </webServices> </scripting> </system.web.extensions> <system.serviceModel> <services> <service name="EntityGateway.UtilityService" behaviorConfiguration="InterceptorBehavior"> </service > </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> <behavior name="InterceptorBehavior"> <interceptorBehaviorExtension /> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <extensions> <behaviorExtensions> <add name="interceptorBehaviorExtension" type="EntityGateway.InterceptorBehaviorExtension, EntityGateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> </behaviorExtensions> </extensions> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>I am using an Inerceptor to validate the incoming request and unsure how to add the endpoints. the test page I am adding is currently within the same site so it cannot be a crossdomain problem.
Any help would be appreciated.
regards
Tom
Pengzhen Son...
Star
8276 Points
848 Posts
Microsoft
Re: WCF ENDPOINTS?
Jan 23, 2013 01:53 AM|LINK
You can refer this
http://weblogs.asp.net/paolopia/archive/2007/08/23/writing-a-wcf-message-inspector.aspx
http://forums.asp.net/t/1764158.aspx/1
And I think you can post the thread to wcf forum where you can get more professional information.
Hope it can help you.
Feedback to us
Develop and promote your apps in Windows Store