By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Calling aspx page from htm file

P: n/a
Hi,
I am trying to call an aspx page from an htm file.
I have written something like this in my htm file

<script src="Test.aspx"></script?

The Test.aspx page should call a javascript function and should show an
alert.

How can i acheive it. If I call the aspx file directly it works as
expected but not from htm file.

I tried using <img src="Test.aspx"but again no luck.

Any help, appreciated.

Sep 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Ravi wrote:
Hi,
I am trying to call an aspx page from an htm file.
I have written something like this in my htm file

<script src="Test.aspx"></script?

The Test.aspx page should call a javascript function and should show an
alert.

How can i acheive it. If I call the aspx file directly it works as
expected but not from htm file.

I tried using <img src="Test.aspx"but again no luck.

Any help, appreciated.
You need to understand how the web works. The server and the clients are
two totally different worlds, they run in different processes, under
different conditions, often on different machines.

The only thing that the server can do is send some text (and in some
cases binary files) to the client. How this text is executed is purely a
client-side matter, and the server has no idea what will happen to that
text.

In your first example, if the page Test.aspx delivers JavaScript code
(which is nothing else than text to the server), and if it delivers it
with the correct MIME type, then the browser will attempt to interprete
the script. What action it takes after that totally depends on what
script code you send back to the client. It is absolutely impossible
that the "Test.aspx page should call a javascript function and should
show an alert", because the server just sends text back to the client.
From the client's point of view, what happens here is exactly the same
than if you had set Test.js in the SRC instead of Test.aspx.

In other words, it is impossible to help you without seeing the output
of the Test.aspx page, without making sure that the MIME types are set
correctly, and without knowing more about the rest of your client-side code.

The second example worries me, because it makes no sense at all. What
kind of effect do you expect by passing some text data to an object
which expects a binary output?

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 6 '06 #2

P: n/a
as long as the asp file only returns javascript code (no html) it should
work.
<@ Page language="C#">
alert('hi');

the above page should work

-- bruce (sqlwork.com)

"Ravi" <hk*******@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
Hi,
I am trying to call an aspx page from an htm file.
I have written something like this in my htm file

<script src="Test.aspx"></script?

The Test.aspx page should call a javascript function and should show an
alert.

How can i acheive it. If I call the aspx file directly it works as
expected but not from htm file.

I tried using <img src="Test.aspx"but again no luck.

Any help, appreciated.

Sep 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.