Showing posts with label own. Show all posts
Showing posts with label own. Show all posts

Wednesday, March 28, 2012

Profilewebserice path doesnt work under virtual url.

I tried to find a way to replace profilewebservice with my own webservice or class, and then I found a problem. I don;t believe it is happening, but I am not sure what is wrong.

In ATLAS.js, we can find code like

Sys._Profile.WebServicePath = 'ScriptServices/Microsoft/Web/Services/Standard/ProfileWebService.asmx';

see the webservicepath is relative. When I go tohttp://mydomain.com/page/home.aspx, and do Sys.Profile.Load, I get this error:

Parser Error Message:The directive 'Page' is unknown.

Source Error:

Line 1: <%@dotnet.itags.org. Page Language="C#" ValidateRequest="false" ViewStateEncryptionMode="Never" Debug="false" EnableEventValidation="false"Line 2: CompilationMode="Never" Inherits="LinkLibrary.LinkPage" %>


Source File:/page/ScriptServices/Microsoft/Web/Services/Standard/ProfileWebService.asmx Line:1

looks like it add my virtualpath in, that doesn't sound right?

Well, it looks like your web service .asmx file has an @.Page directive in it... no? Which is wrong, if true. That's how it appears to me from what you've posted, anyway.

the asmx is ATLAS asmx.

It shows where the error happens, the @.Page is in my page.


? you said you replaced the prepackaged asmx with your own in your first post. Maybe if you posted your code, it'd be easier to help you debug it?

Oh, that confused you.

What I tried to say is I tried to find a way to use my asmx, but before I found a solution, I found a bug .

What I put on my page is just like this :

Sys.Profile.set_autoSave(false);
Sys.Profile.loaded.add(onProfileLoadComplete);
Sys.Profile.load();

and I got that error, because the test url ishttp://mydomain/page/home.aspx.

It seems the webservice add the page into its webservicepath.

If this is really a bug, I think ATLAS group should fix it. I am not sure why others didn't find it.

Line 1: <%@. Page Language="C#" ValidateRequest="false" ViewStateEncryptionMode="Never" Debug="false" EnableEventValidation="false"Line 2: CompilationMode="Never" Inherits="LinkLibrary.LinkPage" %>


Source File:/page/ScriptServices/Microsoft/Web/Services/Standard/ProfileWebService.asmx Line:1

You can tell from the error message, "ScriptServices/Microsoft/Web/Services/Standard/ProfileWebService.asmx " is what ATLAS defined in its js, but the path doesn't have "/" in front of it, I think that is where the problem from.



Have you tried giving it an absolute url just to test it and see if it's not getting hung up on where to start?


Yes, now I am using my own asmx, I set it with absolute path, it works fine under that url - /page/home.aspx
Glad to hear it!

Monday, March 26, 2012

Programmatically Show UpdateProgress on Content Page

Hi, this question has arisen from another thread I posted but seemed worth having its own thread. I have followed the tutorial explaining how to programmatically show an UpdateProgress control using javascript found here:

http://www.asp.net/AJAX/Documentation/Live/tutorials/ProgrammingUpdateProgress.aspx

The example works fine if I copy it on a stand alone web form, but will not work when I use it as a content page for my project's master page. My master page does not use any ajax components. What is the difference that's disabling this code?

Try replacing any instance of

$get('UpdateProgress1')

with

$get('<%= UpdateProgress1.ClientID %>')


DisturbedBuddha's post should fix your issue.

TheContentPlaceHolder control implements INamingContainer which basically appends a string to make your controls unique. By using the ClientID, you are returning the actualy ID that will be rendered.

-Damien


Thanks, I didn't realize that the control name wasn't changed otherwise. Surprisingly, it still doesn't work...until I looked at my javascript. Here's microsoft's example:

...function InitializeRequest(sender, args) { if (prm.get_isInAsyncPostBack()) { args.set_cancel(true); } postBackElement = args.get_postBackElement(); if (postBackElement.id =='Panel1Trigger') { $get('UpdateProgress1').style.display = 'block'; } }function EndRequest(sender, args) { if (postBackElement.id =='Panel1Trigger') { $get('UpdateProgress1').style.display = 'none'; } }...
As you can see 'Panel1Trigger' is also referenced by its server ID, not the ID given by the INaming container. So here is the code that works:
...function InitializeRequest(sender, args) { if (prm.get_isInAsyncPostBack()) { args.set_cancel(true); } postBackElement = args.get_postBackElement(); if (postBackElement.id =='<%= Panel1Trigger.ClientID %>') { $get('<%= UpdateProgress1.ClientID %>').style.display = 'block'; } } function EndRequest(sender, args) { if (postBackElement.id =='<%= Panel1Trigger.ClientID %>') { $get('<%= UpdateProgress1.ClientID %>').style.display = 'none'; } }...
What a pain! Thanks for your help!