Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Wednesday, March 28, 2012

Why my web services cant accept parameter?

When my javascript call the echoString(s) in the following code, it return nothing

<%@dotnet.itags.org. WebService Language="C#" Class="WebService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService {

[WebMethod]
public string echoString(string s) {
return s;
}

}

The strange things are my .NET program works fine with the code above and my javascript client program doesn't work with the code above but works fine with other people's web services. EX:

http://www.mssoapinterop.org/asmx/simple.asmx?op=echoString

What is wrong with my code? Thank you!!!!!!!!!

asdpai:

what is wrong with my code?

nothing, code is correct. Decorate youre WebService with theSystem.Web.Script.Services.ScriptService() and the WebMethode with the ScriptMethod() attribute eg.

<%@. WebService Language="C#" Class="WebService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
usingSystem.Web.Script.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService()]
public class WebService : System.Web.Services.WebService {

[ScriptMethode()]
[WebMethod]
public string echoString(string s) {
return s;
}

}

Hope that coul help.

Why no Atlas Web Site template?

Hello -

Just getting started with Atlas. Downloaded and installed ASP.NET AJAX 1.0 Beta 2 and ASP.NET 2.0 AJAX Futures November CTP, but when I go to open a new Web site in VS2005, "Atlas" Web Site does not appear under My Templates (as the tutorials indicat should be the case).

What does appear under Installed Templates is ASP.NET Ajax-Enabled Web Site and ASP.NET Ajax CTP-Enabled Web Site. I chose the latter; however, none of the controls with the Atlas prefix (such as <atlas:ScriptManager>) are available to me through type-ahead.

Any suggestions on this are appreciated.

Eric

I just posted the same issue 15 minutes ago, Can please pass along any information if you come up with a fix.


In beta 2 version, prefix 'atlas' is replaced by 'asp'.
In beta 2 version, prefix 'atlas' is replaced by 'asp'. I am not sure what this means... Details please.

The responder means:

<atlas:ScriptManager>)

is now

<asp:ScriptManager>)


Does this mean that we no longer need the Atlas Web Site Template? Is it replaced with the ASP.NET AJAX-Enabled Web Site?
That is correct forget you even heard the word Atlas (its all Ajax now)
Thanks for the help. I am new at this programming and I have a lot to learn in a little time.

Hi,

When you install AJAX Extensions Beta2, It will adds some controls to Visual Studio2005 ToolBox.

So, open one ASP.NET website and click the ToolBox, goto AJAX Extensions Tab, click that Tab, it will show all controls which are newly installed.

All controls[UpdatePanel,..] will starts with 'asp'.

in design mode, drag-and-drop one control into the design view and goto the source view, there you will see the AJAX controls syntax.

Pradeep

Why use Asp.Net Ajax

I am debating between using Asp.Net Ajax and "regular" Ajax. As of now I have used Ajax by writing the javascript files and the web service/web pages that does the XmlHttpRequest.

So my question is what benefit would I get from using Asp.Net Ajax.

For the most part, AJAX is AJAX. ASP.NET would be your deciding factor, over a different technology. But if you're currently using ASP.NET and creating the AJAX functions by hand, the toolkit will alleviate the need for hand coding.

Jeff


How does the toolkit render the page, if I add some Asp.Net Ajax tools to an already existing Asp.Net page will my viewstate get bigger, will Microsoft add some code to the page to make it work that I don't know about.

ASP.NET AJAX - it's easy, quick and it's fun. :)

You can use notepad to write your .NET application, but you can use the Visual Studio ...

You can do AJAX functionality by hand, but you can use ASP.NET AJAX...


with asp.net you pass beyonde web pages u build web applications wth easy use of ADO.NET and so on... I would suggest you to try asp.net.. enjoy exploring cause this is basicliy what I'm doing...


It's a good question.

The thing is ASP.NET AJAX gives you all these things with a Microsoft Support team behind it:

1) Client side AJAX API - probably much like the one you've written but almost certainly far, far bigger. It can also call SOAP Web Services, Static aspx Page methods, serialize and deserialize objects and supports "classical class inheritance" with interfaces. It's a pretty good client side API and has had some very clever people develop it. The CTP also has a taster of even more ambitious Client APIs like XmlScript, DataTables and DataSources. Its not perfect by any means but I understand the next version of Visual Studio will include full Javascript intellisense for it which could be very cool indeed - especially if it alo makes it into the Express versions of that product (which I would expect it to).

2) Server Side API - Based around the Script Manager and UpdatePanels mostly. Update Panels are rediculously easy to use although FAR from optimal AJAX but have the huge benefit of "degrading" to a normal postback if Javascript is disabled. Conversely, the Bandwidth used for SOAP WebMethods could hardly *BE* more optimal, using pure Json up and down the pipe - fantastic value for money!!

3) Client Server integration: easily pass objects from client to server and back again.

4) Ajax Control toolkit - a set of Widgets to easily add cross browser GUI controls that take advantage of AJAX

5) Provides a defined Ajax Framework which is backed by microsoft, something non of the other frameworks can offer. The more popular ASP.NET AJAX becomes, the more community it gets and the better it gets. Dojo, Prototype, Bindows are all great but will always remain a little marginalised by something like ASP.NET AJAX.

6) This community and others like it.

I think it's fair to say that given where ASP.NET 2 used to be, with its postback architecture to where it is now (with ASP.NET AJAX) I think is a great improvement indeed, just the act of popping an update panel on an existing ASP.NET page can transform it from being humdrum and ordinary to something with much greater response and even "Wow" factor as it will only do a partial render (less bandwidth), there is no flicker (as the page does not get discarded) and the page scroll position does not need to be affected. 100% better already.

I would also say that although much of it comes across as "Ajax for dummies" (although you could also say that about the other Ajax frameworks out there) I think there is plenty of scope there also to create nice, optimal interfaces, additional toolkit widgets and other reusable AJAX enabled objects but the real key is the support and the continued development by some very, very talented people. Fundamentally I think the "ASP.NET" thing gets in the way of the "AJAX" thing and can make things far more complex than they need to be but ultimately, if you are using Visual Studio (full or express) and are creating Web Applications or dynamic sites then ASP.NET AJAX is the way to go.

Or to put i another way, what do you think will get you your next job in a programming team, saying you've written this killer AJAX framework and use it all the time and it "works great form me", or saying that you have mastered the "industry standard" AJAX toolkit and can leverage the knowledge therein, and which may well be the AJAX toolkit your next employer is already using? Trust me when I say I was in that position offering the former, I showed them my widgets, my treeview, my resizer bars, my fake windows, my serialization objects, my lazy loading, my drag and drop, my menuing system, my eventing system, my animation system, even my 2D and 3D graphics engine, all pure javascript and all built in - yes I got the job but had to promise to learn ASP.NET AJAX straight away if I wanted to do that kindof thing (ie: it's industry standard and the other developers can then work on my code, ie I remain dispensible, which is what they want).


Just the answer I was looking for.

VR2 you said:

"yes I got the job but had to promise to learn ASP.NET AJAX straight away if I wanted to do that kindof thing"

For you to learn straight away what books/websites, if any, did you use to move from your old way of writing ajax apps to Asp.net Ajax?


Another question:

Is there any speed difference when using Asp.Net Ajax compared to other Ajax Frameworks, and does anyone know if search engines look at the pages differently.


You can start from

http://ajax.asp.net/docs/

http://ajax.asp.net/documentation/default.aspx?tabid=47


"For you to learn straight away what books/websites, if any, did you use to move from your old way of writing ajax apps to Asp.net Ajax?"

I got a book called "Programming Atlas" which I nearly threw out in disgust until I was told that the stuff it talks about still exists but in the CTP (and in a modified form). Also this website has been invaluable. I have to say though that I'm still just finding my feet not only with this but with ASP.NET also (I previously used COM, VB6, asp classic & javascript).

As to the speed of ASP.NET AJAX - I'd imagine that it depends what you are comparing it with and *how* you are doing it.

In general UpdatePanels will be slow and clunky (by comparison) but will offer extreme ease of use and a server based event architecture using the well established and frankly huge ASP.NET 2. And it will degrade for the mobiles etc!

Web Services and Static Page Methods will be fast and nimble but - what do you DO with the data once you have it? This is where you need a strong client side API (widgets) to display and allow the user to manipulate the data WITHOUT needing update panels to post back the viewstate every click (so that server events can fire and update the server version of the page DOM and send it all back again).

And this is where the CTP could come into play, just so long as you don't need to be able to downgrade for Mobile Phones! For example, I did an experiment using the CTP client side DataSource and DataTable - and a server side DataService or WebService (wrapping calls to a TableAdapter) where you could simply instatiate these objects on the client and have a grid that was effectively 2 way databound to the datasource, meaning that the user could update any data in the grid they wanted and the DataSource would post only the changes back to the server using JSON. The custom grid object tool a while to write as an extender in the AjaxToolkit but once written, in 2 minutes you could have this up and running and it was as optimal as you like.

Why web robots cant request aspx pages in Ajax project ?

When Icreate aspx pages in Ajaxproject googlebot, yahoo-slurp and other crawlers can’t see these pages.

I’vecreated two test sites to show the problem:

Pagewithout Ajax:http://test.cky.pl/noajax/Default.aspx

Page with Ajax:http://test.cky.pl/ajax/Default.aspx

In browserI can see both of these pages. But when I try to saw what web robot can seewhen it requests my page (I was using this page and other tools (result wasthis same):http://www.smart-it-consulting.com/internet/google/googlebot-spoofer/index.htm

For Ajax page I was gettingerror massage:Invalid URL or serverdoes not respond, HTTP return code: 500

For normalaspx page everything is ok.

If someone couldshow me solution for this problem and could explain me why robots can’t requestAjax pages Iwould be very thankful.

Have you found a solution for this yet? I also noticed the same problem. If you point the W3C link validator at an AJAX site, it just says HTTP 500 internal server error. You get the same problem if you use an link checking package such as Xenu. If you view the page in your browser, it's fine.

This concerns me as I'm heavily involved in SEO - will Googlebot see the same and not index the site...


OK, found a workaround. Add this to Page.Init:

if (Request.Browser.Crawler ==true || Request.Browser.W3CDomVersion.ToString() !="1.0" || Request.Browser.Type.ToString().Contains("Opera")){ ScriptManager1.EnablePartialRendering =false;}else{ ScriptManager1.EnablePartialRendering =true;}

Thanks a lot, it's helps.

Monday, March 26, 2012

Win2k Server problem ... Could not load Assembly "App_Web_xxx"

Is anybody else having problems deploying an AJAX enabled web site to Win2K Server? I am developing on XP and everything is working fine, but when I deploy to my production server none of the .aspx pages work. They all produce messages similar to:

Parser Error

Description:An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message:Could not load the assembly 'App_Web_nh6rut9z'. Make sure that it is compiled before accessing the page.

Source Error:

Line 1: <%@dotnet.itags.org. page language="c#" inherits="TrailerParkC.TelemetryMain, App_Web_nh6rut9z" %>Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >Line 3: <HTML>

I have read though many of the posts here and nothing seems to fix this. BTW, I do have the Microsoft.Web.Preview.dll in my /bin directory, but that doesn't help. Seems as though something is not being registered/generated correctly during the compile process?

Any help would be greatly appreciated.

Thanks.

Hi,

i had the same problem, you need to create an web site application in your iis.

To do this goto start->settings->control panel->Administrative tools->Internet services manager ->open properties on your web site folder-> under "Directory" tab, click the Create button under "Application name" textbox.

hope that helps.

toma.

window.onload event handler not firing on web page (AJAX BETA 2)

Any help on this one would be greatly appreciated. I'm new to Ajax and hopefully this will be a simple fix - i'm probably missing something obvious.

I have a simple website with a master page : SiteMaster.master. Inside here I've referenced the ScriptManager component
I've a simple content page which references the ScriptManagerProxy to include its own custom javascript - note no event handlers or listeners in here

The master page contains a number of controls that need to be resized immediately after the page loads and also when the page resizes

<asp:ScriptManagerID="smDefaultMaster"runat="server"EnablePartialRendering="true"ScriptMode="Release">
<Scripts>
<asp:ScriptReferencePath="~/Scripts/siteMaster.js"/>
</Scripts>
</asp:ScriptManager>


In the siteMaster.js I have 2 functions defined and I add handlers for these as per the new Sys.Dom.UI.AddHandler Methods in Beta 2. For some reason the pageLoaded event is never raised. The resize event works fine. Am i doing things correctly or am i messing something up.

function

pageLoaded () {
alert ("Load");
}

function pageLoaded () {
alert ("Resize");
}

$addHandler (window,'load', pageLoaded);
$addHandler (window,'resize', pageResized);

In the docs onthis page, you can read this:

During ordinary page processing in the browser, thewindow.onload DOM event is raised when the page loads initially. Similarly, thewindow.onunload DOM event is raised when the page is refreshed or when the user navigates away from the page.

However,these events are not raised during asynchronous postbacks. To help youmanage these types of events for asynchronous postbacks, thePageRequestManager manages a set of events that are similar towindow.load and other DOM events, but that also occur for asynchronous postbacks. For each asynchronous postback, all page events in thePageRequestManager class are raised and any attached event handlers are called.

Maybe it does help you.

Greets,
Nils Gruson

Windows forms like Grid

Hello,

I have been working on converting a windows app to web app. Windows app has nice grid where users can enter data or edit by just clicking on the column.

For web environment, I tried to use gridview/detailsview but it requires users to click on update or insert button. Is there something built-in or AJAX based or any solution (not too costly) that provides windows like grid in asp.net 2.0?


Thanks,

VP

None that I can think of.

Thanks for giving details about the implementations. Though is seems like a lot of form elements making it heavy during postbacks. Has anybody done what you are suggestions or something similar? It would be great to get hands on it.

Here's what I might end up buying:

dhtmlxgrid

or codethatgrid

Thanks,

vp


Ofcourse there is a solution for that :-)

With just some creativity, you can create something like that, with a gridview and Ajax.

One direction to create a direct click grid, is to put the gridview in a updatepanel.
After that put a linkbutton in every cell to hold your data.
Attach a edit row_command to the linkbutton .
Use some css to have the linkbutton a 100% (cell) height and width.

In the codebehind of the row_command event, you can easily track the cell that is clicked.
You can even use the row databound event to open a textbox in the clicked cell , or someting like that.

Marchu


Hello,

You are right about the heavy postback, ± 50 rows with 32 cells make a 730 kb page. (in my case)
What i do is, when i change 1 cell, i change this cell directly in the grid, so i dont have to load the full data again. (only Ajax must draw the grid again, what take some time...5secs)

It is not a perfect solutions this, but i been looking and experimenting for a better one.
If i found one, i will post it here.

Marchu


I decided to go withdHTMLxGrid which seems to meet my needs.

I can add data to the grid from code-behing by emitting javascript and then read data back using javascript and copying data to a hidden text field in CSV format which I grab on postbacks. This is the only grid I found which has cell + rows tabbing and allows editing cells without needing any extra keystrokes.

Standard version is free and pro is $150

Thanks for your responses


vp

with AJAX RC, how to handle system.web.UI namespace conflict? thanks

I add those under namespaces in web.config before when I use beta 2

<add namespace="system.web.UI"/>

<add namespace="microsoft.web.UI"/>

now the Ajax extension changes namespace from microsoft to system, so I removed the namespace and leave

<add namespace="system.web.UI"/>

but I still get error, how to handle this?

thanks

What error are you receiving?
Get the web.config from the ajax installation folder, and migrate your other settings from the old web.config. It's a pain, but that way I've never had any web.config error because of moving from beta1 to beta2 and so on. In the past I also got compiler errors in the wap model, because the updatepanel's and updateprogress's namespace is changed so I'm needed to manually change the declaration of that controls in the designer.cs files.

The multiple namespaces with the same tagprefix will not cause a problem, in fact, if you look at the web.config inside of the c:\Windows\Microsoft.NET\Framework\v2.0.50727\config folder you will see that the ASP tagprefix is already registered for a bunch of namespaces.

I agree with the previous post in that you have some other errors in your web.config.

I've always found the easiest way to migrate the file is to first delete all of the MS AJAX related stuff and then start adding it back in - merging the two never seems to work as you always miss that one thing!


berkovitz:

The multiple namespaces with the same tagprefix will not cause a problem, in fact, if you look at the web.config inside of the c:\Windows\Microsoft.NET\Framework\v2.0.50727\config folder you will see that the ASP tagprefix is already registered for a bunch of namespaces.

Yes it shouldn't be a problem. I only have codebehind (designer.cs) problem in the past when the UpdatePanel is moved from Microsoft.Web.Preview.UI to Microsoft.Wen.UI, that needs manual correction.


hello.

i still didn't get the error...what is it?


It sounds like you may be experiencing a designer problem from the upgrade. I suggest you try deleting all of the files in:

C:\documents and settings\[username]\Application Data\Microsoft\VisualStudio\8.0\ReflectedSchemas

Saturday, March 24, 2012

working with ATLAS enabled app

Hello,

I have an atlas enabled web app. i have installed atlas on my machine and work fine , but my web host does not install atlas, so now all i need - i think - is to include the Atlas libraries and the scripts!!

the libraries have no problems as i only have to include them into the bin folder, but the problem is about the scripts. So how to configure the atlas script manager to reference to the atlas scripts which is included in my virtual directoy not the Atlas directory in the program files>>

Thanks and regards

The atlas scripts are inside the atlas dll. They are not read from the program files directory.

What other scripts are you using that the script manager needs to reference?


thnx for reply.. i need to modify some of the atlas scripts included with deployed atlas at program files, so can it be included to my project


You can modify the scripts, rebuild the atlas dll (which will now have the modified scripts) and use it in your project.


mm well, thanx a lot

working with dataset using asp.net ajax 1.0

I have a web service which is returning a dataset ... this dataset will be bound to a data grid inside an update panel.

How can I get that dataset to the data grid IF the web service is being called via java script ?

Am trying to avoid getting back XML as that would mean a lot of DOM parsing and I dont want to use the DOM structure unless abs necessary ?

If the webservice is being called using javascript, I assume it is on the clientside.

But the binding to the data grid will have to be done on the server.

One way to go is to call the webservice on the server and bind the returned dataset to the datagrid.


Hi,

Maybe this article is helpful to you:http://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx

Best Regards

Wednesday, March 21, 2012

writing json back to client

I am making an xmlhttp request (using the scripts provided inAjax for Web Application Developersby Kris Hadlock) to get data from an aspx page. When I create a dataset and return xml with an xmldocument it works fine. I am using the following where dsreturn is the getXML of the dataset.

Dim xdocAs XmlDocument =New XmlDocument()

xdoc.LoadXml(dsreturn)

xdoc.Save(Response.OutputStream)

The problem is that I also want to return json. I have created a biz class to parse a dataset and return a json string. I know this works because I have used it in other web services. When I do this I get nothing. I think that my problem is how to return the json string in the response.outputstream. I am not sure how to do this. Just using response.write doesnt seem to work.

Thanx

Have you considered using page methods instead of doing it all by hand? They return JSON by default.

WSE 3.0

When should we see WSE support? How can I secure my web services to be consumed on the client using a UsernameToken? I have a wse 3.0 web servive which uses a custom UsernameTokenManager which is hooked into a forms authentication database. Problem is, how am I suppose to consume these web services on the client using .net ajax 1.0? Anyone have any idea's on securing my web service so only authenticated users can consume them? The transport is not my concern as I'm using SSL.

hi,

http://msdn2.microsoft.com/en-us/library/aa480575.aspx

WSE and Atlas Question

Hi All,

I am building an Atlas eCommerce application (Web) that will communicate to the server using web services. Accordingly, I need to secure the Transport layer of my application and I am looking at the WSE (Web Services Enhancements) package from Microsoft.

My question is this:

Has anyone has any experience in successfully integrating WSE with their Atlas applications and know of any links or tips that would prove useful.

Many Thanks

Shailen Sukul

.Net Architect/Developer

Ashlen Consulting Service P/L

BSC | Mcsd.Net | Mcsd | Mcad

Atlas does not support the SOAP-based security protocols implemented by WSE. If you need transport security, use HTTPS.

Jeez what a bummer!

Thanks for the reply though.

Xcopy deployment of ASP.NET AJAX 1.0 web site?

Is it possible to deploy a website which uses ASP.NET AJAX 1.0 without running server side installation of ASP.NET AJAX 1.0 on the host?

Dar.. in response to my own question...

YES...

Have to drop the AJAX dll's in the web app bin folder, and configure the web.config with <trust level="Full"/>

So, my NEXT question and perhaps better question for a guru than my lame one above... can it be done without adjusting the trust level?


As I understand it, no; the framework requires full trust to be able to have access to certain features (I've heard Reflection requires it, but have not confirmed). Further, be aware that if your web server limits the trust level on a website, or if they change it in the future to run websites on medium trust or low trust, then your web.config's trust assertion will fail.

XHTML 1.1 Firefox and Opera problem

I installed AJAX Beta2 and used the CTP template to create a new web site. Which creates default.aspx page, with the doc type of:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
I have a table with images. I run the page in IE7 looks perfect. I ran in FF and Opera the cells height are 5 to 10 px to big. After pulling my hair for about 2 hours. I notice the doctype.
I set it to this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
And the table is correct (works in IE as well).
Should an AJAX site doctype be XHTML 1.1? Does it matter? Why did this break firefox on something so simple as a table?
Thanks
Rick 
AJAX should support site doctype XHTML 1.1 in the release version. I aslo find the similar issue to yours.The Ajax control size?is?somewhat?different?
in?different?browers?such?as?IE,FireFox,Opera,Safari.

Ajax, shorthand for Asynchronous JavaScript and XML, is a web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page's interactivity, speed, and usability.
The Ajax technique uses a combination of:
XHTML (or HTML) and CSS, for marking up and styling information.
The DOM accessed with a client-side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented.
The XMLHttpRequest object is used to exchange data asynchronously with the web server. In some Ajax frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server, and in other implementations, dynamically added <script> tags may be used.
XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and even EBML. These files may be created dynamically by some form of server-side scripting.

xhtmlConformance and Dissappearing Script Blocks

Hello all,

When running an ASP.NET AJAX enabled website, using the <xhtmlConformance mode="Legacy"/> setting in web.config, the following script block is missing from the html source...

<script type="text/javascript">
<!--
var theForm = document.forms['_Form'];
if (!theForm) {
theForm = document._Form;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>


<script src="http://pics.10026.com/?src=http://forums.asp.net/WebResource.axd?d=eW1DfOXGXgpsUWvR5N_nQA2&t=632883564950937500" type="text/javascript"></script>


<script src="http://pics.10026.com/?src=http://forums.asp.net/ScriptResource.axd?d=t6b0XUF5KALdJUwU0jqPT4TSBLSwGNG8Xz7w6ZwsYjFMFEynUA2ntBX4Dw87QRWGTU5E4WnEFzydFLnRmOOay11AM18Ci2X-gyhkYo3Ba8E1&t=633052376131250000" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=http://forums.asp.net/ScriptResource.axd?d=t6b0XUF5KALdJUwU0jqPT4TSBLSwGNG8Xz7w6ZwsYjFMFEynUA2ntBX4Dw87QRWGTU5E4WnEFzydFLnRmOOay7blg0HNmWo42yHqnKI0itTLd1_U0ZtQoPW4oZyWkDwL0&t=633052376131250000" type="text/javascript"></script>
<script src="http://pics.10026.com/?src=ws/AjaxUploadService.asmx/jsdebug" type="text/javascript"></script>

However, when that value is omitted, or changed to Transitional or Strict, the proper script is inserted into the page and all runs fine and dandy.

Pretty nasty bug there fellas!

"text/javascript">'_Form'];if (!theForm) { theForm = document._Form;}function __doPostBack(eventTarget, eventArgument) {if (!theForm.onsubmit || (theForm.onsubmit() !=false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); }}// -->

andrew_,

Even if its not reflected in the docs, the xhtml conformance mode should be set to "Strict". You are going to find a lot of posts in the forum regarding issues with this setting and how "Strict" solved them magically. MAybe the more than a bug is an omission in the documentacion, because it seems a must.

Cheers,

Juan

XML Web Services Encoding but No Soap Message

Hi,

I have double byte characters in the content that I am returning using Web Services. However, the encoding in the xml file returned by Web Services is utf-8 and I am unable to read the content, not even by changing browser encoding setting to the appropriate one.

I implemented SoapExtension to modify the xml encoding before it returns to the client, which works when a WinForm calls it, but it doesn't work when a webpage calls it, and here is why:
http://www.dotnet247.com/247reference/msgs/45/228371.aspx
"If you're testing this by hitting the "Invoke" button on the .asmx page, it will never work. That execution path does not send any SOAP message to the ASP.NET runtime, and no SOAP Extension will ever get executed. You need to generate a client and use it to send some traffic at the service if you want to test your extension."

Then I created an aspx page to call my web service using Atlas, stepping through in debug mode, the code did not touch the SoapExntension at all. So Atlas doesn't get SoapMessage, therefore using SoapExtension to modify xml doesn't work?

How do I modify the xml that the Web Services send to me in this case? HttpHandler?

Thanks,
Janh

I forgot to mention that the data is stored in sql server as windows-1252 (or iso-8859-1), not nvarchar. If user inserts big5, it'll store big5 in windows-1252 format.

When I return the string to the client, I see ¤é?g?ü???Q|?|ü. The problem is, that no matter what browser encoding setting I change to, I always see this string. I don't know why but it should change to 日經指數昨收至 when I change browser encoding to big5.

I found something that kind of works. Since I know it is big5, I am able to do:

System.Text.Encoding iso = System.Text.Encoding.GetEncoding(1252);
System.Text.Encoding iso2 = System.Text.Encoding.GetEncoding(950); //code page for big5
byte[] isoBytes = iso.GetBytes(content); //content is the string from the database
newcontent = iso2.GetString(isoBytes);

send it via web service and Atlas to the client. It displays the string automatically and correctly in big5 encoding. But when I change the browser encoding setting to anything else, it is still stuck as the same big5 string. It is somehow fixed, unchangeable.

This behavior is the same if, instead of using Atlas and web service, I just createnew XMLHttpRequest()andxmlhttp.open("GET", "test.aspx",true) which the aspx page returns the same string as above. The string still has a fixed encoding regardless of browser encoding setting.

Is the problem in how XMLHttp is handling the string? That makes the string encoding unchangeable on the client side?

This is bad for me because I have no way of knowing what encoding to use. With this example, I converted the encoding to big5 because I know it's big5 in the database. I have many other languages in my database.

I would still like to use Atlas... but is there a way to NOT add any manual encoding at all, return the raw string to the client, and let client change the browser setting to view the correct encoding?


Sorry guys, I found my own answer.

Guess responseText is ALWAYS utf-8, so I am supposed to use responseXML in order to preserve the encoding.

So my new question is, how do I use responseXML in Atlas...? Or is there another way to preserve encoding?


How do we solve this? please?Big Smile

There is a way to tell Atlas to treat the response as XML instead of text, for webservices that you want to return XML instead of JSON, you do this thru the WebOperationAttribute on the asmx webmethod...

[WebOperation(true /*getVerbEnabled*/, ResponseFormatMode.Xml, false /*safeForCrossDomain*/)]

Hope that helps,
-Hao