Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...How do I call custom HTTP handler from JavaScript?How do I call custom HTTP handler from JavaScript?
Previous
 
Next
New Post
3/20/2009 12:56 PM
 

Hello,

I have the following problem: I would like to make an async request in JavaScript to custom HTTP handler (created by myself, let's say, handler.ashx).

But I cannot execute it all times as DesktopModules/MyModule/handler.ashx.

First time after I open my portal, it works ok (when browser's URL is like http://localhost:53418/WebSite/). But after I make some actions there (f.i. press Home), my URL becomes like http://localhost:53418/WebSite/Home/tabid/37/Default.aspx, and my handler is not executed (a DNN page is returned).

If I specify path to my handler as http://localhost:53418/WebSite/DesktopModules/MyModule/Handler.ashx, it works OK in both cases.

But it is not good to specify full path including domain name.

How can I overcome this (i.e. specify relative path only)? Thanks in advance.

 

 
New Post
3/20/2009 2:40 PM
 

Nerve wrote

But I cannot execute it all times as DesktopModules/MyModule/handler.ashx.

First time after I open my portal, it works ok (when browser's URL is like http://localhost:53418/WebSite/). But after I make some actions there (f.i. press Home), my URL becomes like http://localhost:53418/WebSite/Home/tabid/37/Default.aspx, and my handler is not executed (a DNN page is returned).

Try referencing the script with an absolute path (not the relative syntax you're currently using). The reason you need to use an absolute path is because of the FriendlyURL provider in DotNetNuke. Basically just reference your javascript like this, and everything should just work.

/Website/DesktopModules/MyModule/handler.ashx

If you really want to use a relative path, you'll most likely have to run the register javascript file dynamically at runtime. I've used something like this in my DNN5 travel, it should get you going as well. 

Page.ClientScript.RegisterStartupScript(Me.GetType(), "name_of_script_to_prevent_duplicates_getting_registered", Me.ControlPath() & "handler.ashx", True)

Hope this Helps

 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...How do I call custom HTTP handler from JavaScript?How do I call custom HTTP handler from JavaScript?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out