Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Monday, March 26, 2012

Accessing ASP.NET Session object during calls to Web Service Bridge?

Hi there,

Just getting started with the Web Service Bridge, looking at the MSN search example.

I've built my own Atlas enabled ASP.NET web application and created a .asbx file that points to an external Web Service and I can call methods on the Web Service through the class I derived from BridgeHandler, so all looking good.

Now I want to be able to make my BridgeHandler derived class interact with the ASP.NET Session object to set and retrieve session data from within my ASP.NET web application.

I can't see a way I can get at the Session object once I'm in my BridgeHandler derived class? Is this possible, or is there a way the Session or Context object can be passed as a parameter to my BridgeHandler derived class through the .asbx file?

I notice the MSN example uses the following syntax to pass a value stored in the Web.config as a parameter:

<parameter name="appId" value="% appsettings : MSNWalkthroughAppId %" serverOnly="true" /
Is there simlar syntax for passing the Session object? Are the options for what you can do in between the %% tags documented anywhere?

Thanks,

Mark

Hi Mark,

Right now we don't support an expression for session within %%, but we will consider adding it in the future. You can get access to Session thru HttpContext, which you can access thru HttpContext.Current...

In terms of expressions currently supported:

args: request args
appsettings: config
resultschain: see quickstart on chaining bridges declaratively
querystring: useful if you use HTTP get to make your bridge requests

Hope that helps,
-Hao


Doh, actually it turns out you can't access Session thru HttpContext.Current because we aren't emitting the proper interface on the generated class, so we'll definitely need to enable this in a future release, but at this time you unfortunately don't have any way to get to the session data...


Thanks for the response. I've just install the April release of Atlas and it doesn't appear to be in there yet either. Looks like I'll have to wait and in the meantime keep experimenting with other parts of Atlas.

Don't suppose you can give me any idea roughly when this feature will be included? (a bit hopeful I know :-)

BTW - does the current 'Context' object on the BridgeHandler class do anything useful at this stage? I get an exception 'Accessing context too early, it is null' exception when attempting to use that object.

Cheers,

Mark

Unfortunately this came up too late to get into the April CTP, but most likely we will get it in the next CTP...

You should be able to access the BridgeHandler.Context from within any of the bridge pipeline methods, basically the first thing that BridgeHandler.Invoke does is build the Context, so within the other virtual methods that you override, you should be able to access the BridgeContext, where are you trying to use the Context object?

Hope that helps,
-Hao

Access Properties in codebehind

How can i access properties of DragPanel in codebehind?

For example, in test.aspx i have DragPanel, i want change the DragHandleID property in codeBehind... ? I cant access it. Thanks for any reply.

ThoNT

Assuming it's the first one in the list...

dragPanelExtender1.TargetProperties[0].DragHandleID = "newHandleID";


sburke_msft:

Assuming it's the first one in the list...

dragPanelExtender1.TargetProperties[0].DragHandleID = "newHandleID";

but if's not the first one in the list... and we dont know the index of it. (because we creat it by an for looping)


Well you can also look at the TargetID property to see which control it's extending

Hi ThoNT,

I think the easiest way to dynamically get the properties is to use the control you attached the extender to (i.e. the control you're setting as the "TargetControlID"). You can just do the following:

DragPanelProperties properties = dragPanelExtender1.GetTargetProperties(myControl1);if (properties !=null){ properties.DragHandleID ="newHandleID";}

Thanks,
Ted


Thank Ted Glaza.

i have just know functionGetTargetProperties from you!

Saturday, March 24, 2012

Accentuation problem

I've an UpdatePanel that has textbox and dropdownlist inside it.
In the textbox I put words with accent, for example: á é í, and the dropdownlist has a AutoPostback = True.
When the SelectedIndex event happens, these controls are reloades but the words that a put with accent shows wrong, ex: ?? ?? ?-

How I correct this?

How about letting the dropdownlist have its own updatepanel?

WS


'Cause all the controls are in the same table, will stay complicated to separate the <td> tags to all the dropdownlist that exists.
But I'll try to do this.


I did your suggestion but the problem happens in the grid now.
I put the words in the text box, select all the dropdownlists and click on a button.
This click save the resulto to a DataGrid, when the resuts go to DataGrid, the words are wrong (accent).

A Simple "Proof-of-Deployment" Example?

Getting started with these improved technologies is always the hardest part and I'm having a devil of a time trying to just prove that AJAX will work on one or more of my hosting accounts -- all of which are "shared hosting".

Does anyone have a simple 3 file (or so) example -- with indications about where the various DLL things should be (besides the obvious areas which are supposed to provided in the shared enviroment in places where your hosting service must put them) that will RUN and prove deployment?

Mahalos in advance ... :) KevInKauai

Oh I want too!

if you get give it to me !Stick out tongue

to E-mail:houdejun214@.163.com


Amazing that there isn't such a "cookbook" around already, isn't it? Or am I missing something obvious?

I'd be more than happy to host such a document or ZIP file or whatever it takes. I've scoured through "AJAX for Dummies" and "Beginning AJAX with ASP.NET" for any clues from the keywords "deploy", "hosting", "server", "dll" and "assembly" without success.

;) KevInKauai


It's pretty simple: ASP.NET AJAX needs to be installed on the server, so if you find your app not working, check with your hoster and make sure they've run the installation.

If you're additionally using the ASP.NET AJAX Control Toolkit, you'll need that DLL in the Bin folder of your app. This should already be the case if you followed their setup instructions.


Thanks, Steve.

I was hoping it would be simple as my local tests seem to go so swimmingly. It's only when I come to deploy (and I'm trying simple tests on a variety of hosters -- including GoDaddy, Ultima_Hosts and Server-Intellect) that I run into anomalies and the finger-pointing begins.

Here is what I've got on Ultima_Hosts, for example:

As you can see, the result plainly do not confirm what I am seeing when running locally.

ALSO ... and this may be an aside, but I ran into a post somewhere which says that one should REMOVE all of the "tagTypes" (6 of them) inside the "tagMapping" section of the web.config file. Is this a change which should be done for ALL AJAX-ified projects? Is there a way to remove those unnecessary references (IF they are) from the project model (or an update)?

Remote AJAX stuff is working just great, but the proof of the pudding is in the deployment for real solutions (for me).

Mahalo ... :) KevInKauai


I don't know about the others, but I believe GoDaddy has installed ASP.NET AJAX 1.0 on all their servers. When it doesn't work, do you see a JavaScript error in the browser?

I'm not sure about the tagTypes settings... where did you see that?


The Support Analyst from UltimatHosts is telling me the following:

Well, here's what I did:
I added a virtual directory to the root.
I copied the files from your folder to the folder for the virtual directory.
I have not seen your configuration in DNP as my first concern was to ensure that it was not a server issue and to make sure that Ajax was installed correctly.

It is definitely an issue with something in your application or with your configuration, not a server issue. You might want to check to make sure that your test folder is running as a root application as it is in the test configuration. This can be done using virtual directories or subdomains in DNP.

Is this something one expects when deploying AJAX-enabled applications in a shared hosting environment? I don't seem to need the same special "virtual directory" for ordinary ASP.NET projects.

mahalos to anyone for shedding light on this fuzzy topic ... :) KevInKauai


Hi KevInkauai,

Based on your descriptions, I'm afraid that you should check your web.config. Here is the document: http://ajax.asp.net/docs/ConfiguringASPNETAJAX.aspx If your problem is not resovled by doing this, another document about migration is given. You can download it here: http://ajax.asp.net/documentation/default.aspx?tabid=47 please focus on "Migration Guides".

One effective checking method is add a sample downloaded fromwww.asp.net to your host and have a test. If still not work collectly, maybe reinstall the lastest Asp.Net Ajax ControlToolkit is a considerable way.

Hope it helps. If you have any new concerns or findings, please share it with us.


Thanks, Steve - -

My baby-simple AJAX test app fails in the same way on both GoDaddy and UltimaHost. The UltimaHost tech guy says that it's because AJAX-enabled applications must be deployed a "virtual root directory" (or something to that effect -- I'm more than a little foggy on this concept). In any case, it's still not working and I'm still in limbo about trying to include AJAX features without a CLEAR document that says (in effect) "here are the special steps you need to deploy".

:) KevInKauai


Hi KevInKauai,

KevInKauai:

Thanks, Steve - -

My baby-simple AJAX test app fails in the same way on both GoDaddy and UltimaHost.

Would you please explain more about what's wrong with this sample?