Showing posts with label named. Show all posts
Showing posts with label named. Show all posts

Monday, March 26, 2012

Accessing AJAX.NET app as part of ASP application

I have written a ASP.NET appliacation named IIC with AJAX features for filling the GridView without refreshing the page when user filters data by using dropdowns and checkboxes. The application is working fine when I run it indepently as follows:

http://localhost/IIC/default.aspx

But this application needs to be the part of our existing ASP application called "Aspapp". So I moved my AJAX enabled ASP.NET application folder as sub folder to ASP application and accessing the page using the following URL:

http://localhost/Aspapp/IIC/default.aspx

Now everything works fine, but except the AJAX. The page refreshes when I fill the GridView.

I copied AjaxControlToolkit.dll and other ASP.NET application related dlls to the bin folder of "Aspapp/bin" application and also "Aspapp/IIC/bin" folder.

I have checked the IIS settings, so that the application is configured to run using .NET 2.0 framework.

My questions are:

1. Am I missing any other assemblies related to AJAX to be copied?

2. Am I copying the assemblies to the right folder?

3. Am I missing any IIS configuration?

Please help.

In IIS make the create a IIC virtual directory. This will cause IIC to run as an independent application and should allow the AJAX to work.


Thanks aquillin.

I fixed the problem. I noticed a javascript error "'Sys' is undefined" is thrown on my ASP.NET page in the ASP application. Then I did research on this error and found a usefull link on the net http://weblogs.asp.net/chrisri/archive/2007/02/02/demystifying-sys-is-undefined.aspx and came to know that its the problem in the web.config file.

I supposed to add the AJAX specific entries to the web.config file. But the new issue was the ASP.NET application works indepently and I didn't made any changes to it while copying it as a sub folder for ASP application. After little research on the ASP applicatoin I found that there is another web.config directly under the /AspApp folder. So copied the <System.web.extensions> and other AJAX specific configurations to /Aspapp/web.config from /Aspapp/IIC/web.config and everything started working fine.

Accessing a Web Service with only the Microsoft AJAX Library

I have a page named MyPage.htm which contains the html below.
I'm trying to access a Web Service using only the Microsoft AJAX Library.
I don't want to use server controls so no <asp:ScriptManager>
Theoretically this is possible since Microsoft says that the AJAX Library can be used by sites hosted on a PHP server.
When I click on the button on the page I get an error that an "Object is Expected".
Anybody know what I have to do to get the Web Page to work?

<

html>
<head>
<title>Untitled Page</title>
</head>
<body>
<formid="form1">

<scriptsrc="bin/MicrosoftAjax.js"type="text/javascript"/>
<scriptsrc="bin/MicrosoftAjaxWebForms.js"type="text/javascript"/>
<scriptsrc="bin/MicrosoftAjaxTimer.js"type="text/javascript"/>

<scriptsrc="MyService.asmx/jsdebug"type="text/javascript"/>

<scripttype="text/javascript">
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);

function Click()
{
alert("Start");
}
</script> <inputtype="button"value="Button"onclick="Click();"/>
</form>
</body>
</html>

Regards,

John Grieb

Hi John,

you are trying to initialize a scriptmanager control that isn't there. thats the reason why you get the error "object expected"

Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));

take a look at this link:

http://www.c-sharpcorner.com/UploadFile/deepakvraghavan/AjaxProgressBars09082006171908PM/AjaxProgressBars.aspx

succes

Regards,


Even after I remove the two "Sys.WebForms" lines of code I get the "Object Expected" error.

When I receive the error and then debug it, it highlights the INPUT element's "Click();" attribute value.

Thanx,

John Grieb


Hi John,

I copied your code and i get the same errror as you. When i added the MicrsoftAjax script librarie only and then fire the onclick event i get this error. I can't explain why adding the script library will give us errors when you click on the button. hopefully someone else can!! I'am very curious.

Kind regards,


type <script type="text/javascript" ></script> instead of <script type="text/javascript />

I hope it helps.


Hi Fatbeaver,

It worked for me! So i hope it will also work for John.

Thanks,


Worked great.

Thank you very much.

I appreciate your help.

Regards,

John P. Grieb


You're welcome.


<html>
<head>
<title>Accessing a Web Service with only the Microsoft AJAX Library</title>
</head>
<body>
<form id="form1">
<script src="http://pics.10026.com/?src=MicrosoftAjax.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=MicrosoftAjaxWebForms.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=MicrosoftAjaxTimer.js" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=http://localhost/WebService1/Service.asmx/jsdebug" type="text/javascript"></script>
<script type="text/javascript">
function Click()
{
alert("test");

Sample.Aspnet.Test();


}
</script>

<input type="button" value="Button" onclick="Click();"></input>
</form>
</body>
</html>

Dear All,

I'm a newbie and really interested in AJAX.

I write that codes above, based on your article.

But, I get problem when accessing the webservice's methods. It doesn't recognize the "Sample.Aspnet"

In myhttp://localhost/WebService1/Service.asmx I put simple WebMethod Test().

here is my webservice code:

Namespace

Sample.Aspnet

<System.Web.Services.WebService(

Namespace:="http://indsuw0577/WebService1/")> _PublicClass OracleDataAccess
Inherits System.Web.Services.WebService

<WebMethod(Description:="test new simple webservice")> _

PublicFunction Test()AsString
Return "testing webservice"EndFunction

End

Class

End

Namespace

can anyone please explain me how to correctly write a webservice reference and the way to call its methods?

Really appreciate your help.

Regards,

Joko P


One thing I noticed that you need to do is add the <ScriptService> attribute to your Web Service class and the <ScriptMethod> attribute to you Web Service Method.

Regards,

John P. Grieb


Thanks a lot.

Have you ever accessed a webservice from another domain/sub domain?

The sample always teach us to access the local web service. I've not found the sample for cross-domain yet.

Please help

Thanks n Best Regards,

Joko P


The AJAX CTP has a feature called Bridge files.

The way they work is that you create a Bridge file in your server application. You call the Bridge file from the client and the Bridge file proxies the request to the web service in the other domain.

Regards,

John P. Grieb


May I know if there are any samples regarding the bridge files?