Hi Roni,

there are two different things to override:

1) When you call the Utility.RegisterTypeForAjax the method will
create a script tag in your Page like this:

<script type="text/javascript"
src="/ajaxpro/Namespace.Classname,AssemblyName.ashx"></script>

If I have a look on your html output I can see some of your internal
stuff like what Namespace your are using, or what the name of the
assembly is. To prevent this for others you can change this with the
<urlNamespaceMappings/> tag in your web.config. Put the the full path
like you see above without the ".ashx" and add a new name for it:

<urlNamespaceMappings useAssemblyQualifiedName="false">
    <add type="Namespace.Classname,Assembly" path="myajax1" />
</urlNamespaceMappings>

With that configuration your JavaScript include tag will look like this, now:

<script type="text/javascript" src="/ajaxpro/myajax1.ashx"></script>


2) The second thing you can do is to hide the name of your namespace
for the JavaScript object (which you use to call the Ajax.NET method).
See this example C# code:

namespace Demo.Web {
    public class AjaxMethods {
        [AjaxPro.AjaxMethod]
        public int Add(int a, int b) {
            return a + b;
        }
    }
}

If you have a look in the JavaScript code you will have there
something like a JavaScript class (note: JavaScript does not know
something about Namespaces, but it looks like a Namespace), you have
to use this code to invoke the method:

<script type="text/javascript">
Demo.Web.AjaxMethods.Add(1, 2, callback);
</script>

With the urlNamespaceMapping you are not hiding this "internal info".
So, you can either create own classes for your Ajax.NET methods (I
prefer this), or change the name to be used in the wrapper. See this
change C# code:

namespace Demo.Web {

    [AjaxPro.AjaxNamespace("ajax1")]
    public class AjaxMethods {

        [AjaxPro.AjaxMethod]
        [AjaxPro.AjaxNamespace("add")]
        public int Add(int a, int b) {
            return a + b;
        }
    }
}

The client-side script code will look like this, now:

<script type="text/javascript">
ajax1.add(1, 2, callback);
</script>



Conclusion: if you want to hide business information use both
settings, or at least the first one with own class for your
AjaxMethods that have a short namespace.

I hope this will help you and answer your question. You have to use
the second way to have something like whatsup.CallServer().

Regards,
Michael




On 4/30/06, roni schuetz <[EMAIL PROTECTED]> wrote:
>
> does somebody can explain me how is should use the following option:
>
> <urlNamespaceMappings useAssemblyQualifiedName="false">
> <!--
> To hide internal knowledge of assemblies, classes and namespace
> you can override the name of the virtual http endpoints.
> <add type="Namespace.Class1,Assembly" path="mypath" />
> -->
> </urlNamespaceMappings>
>
> lets make an example:
>
> i have a namespace in my project:
>
> "com.roni.schuetz" and instead of that i want provide the fake
> namespace: "whatsup".
>
> what do i have to do now?
>
> once i have done that i can use my functions: instead of
>
> com.roni.schuetz.CallServer()
>
> like that:
>
> whatsup.CallServer()
>
> right?
>
> so what do I have to put over there. any help is appreciated.
>
> kind regards,
> roni
>
>
> >
>


--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to