Showing posts with label documentation. Show all posts
Showing posts with label documentation. Show all posts

Wednesday, March 28, 2012

Accessing Guid returned from WebService in Javascript

Hi, I have read through the forum posts and looked in the 'QuickStart' documentation but I am still stuck: How can one read the value of a System.Guid passed back to Javascript?

I have a WebService:
[WebMethod][XmlInclude (typeof(System.Guid))]
public Guid WebLogin(string UserID, string Password) {

Which I call, via Atlas, from JavaScript:
function LogIn(UserID, Pwd) {
K2.WebService.Connection.WebLogin(UserID, Pwd, LogInResult);
}

function LogInResult(result) {
debugger
alert (result);
} ...

I cannot access the value of 'result' (which will be a System.Guid). We used to use the old WebService.htc - where one could access 'result.value' and read the value as a string. I have tried adding the [XmlInclude typeof(System.Guid))], which a forum post hinted at, but nothing was added to the /js as a result.

Thanks in advance for any help you are able to provide.

kangaloosh.ps:

I have used the JSON.stringify() at www.json.org to look inside 'result' and it is empty. Have I got to create a converter class on the server side? If so is there a source code sample somewhere?

Thanks again.

I think a custom converter would be needed to make Guids work, since they don't have any properties that can be automatically serialized to Javascript. But the simplest solution is probably just to change your web method to return the Guid as a string.

How are you planning to use the Guid on the client?


Thanks for the speedy reply;

Will write a string based WebService wrapper for the existing WebMethod (as it is already in use from thick clients).

kangaloosh
Yes, that should work. Please let me know if it doesn't.

Monday, March 26, 2012

Access to the path C:\AJAX_Documentation\web.config is denied.

Greetings,

I download the ajax documentation and i extract it to c:\AJAX_Documentation.

I make a virtual directory called AJAX_Documentation but when i run it i get the following error:

Server Error in '/AJAX_Documentation' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred loading a configuration file: Access to the path 'C:\AJAX_Documentation\web.config' is denied.

Source Error:

[No relevant source lines]


Source File: C:\AJAX_Documentation\web.config Line: 0

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

but i try to move the folder AJAX_Documentation to c:\inetpub\wwwroot so it works fine

so what is the problem,if i extract it to C drive?

i make research on the internet and they tell me that this problem may be because you install .net framework 2.0 afetr IIS which is my case so i uninstall .net framework and IIS and then i install first .net framework and then IIS but i still face the same problem.

so i try another thing to run aspnet_regiis - i so i still face the same problem

so i try another thing : aspnet_regiis -ga "nt authority\Network service" so i still face the same problem

your help is highly appreciated

best regards

That mean Asp.Net user hasn't got right file permission to read your config file.

Try to reconfiguration your file permissions of the C:\AJAX_Documentation\ folder.


thak you for the s

thank you for the support

i try what do you suggest what i already do it but i still face the same problem!!!

so what i do i go the security tab of the ajax_documentation folder and i add the aspnet user and i give him all the permission but i still face the same problem!!

so any other suggestion for this problem?

your help is highly appreciated

best regards


I had the same problem.

I solved it installing the website in c:\Inetpub\wwwroot\AJAX_Documentation

Regards,