[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help fixing ASP error....

Posted on 2007-09-28
7
Medium Priority
?
380 Views
Last Modified: 2008-01-09
I have a packaged software that lets me publish a SCADA application onto the web. It essentially runs an ASP script which returns a jpg of what the operations people are seeing on the screen at that moment. Problem is that the code returned has the private IP address of the machine on which it is installed, so locally on the provate network it works fine, but as soon as your off the network and on the web, my browser doesn't bring up the picture because of the address. The output of the script is driven by some dll or exe what is part of the software and therefore I can't change it. The software manufacturer is looking into it, but don't seem to be anywhere close to finding a solution.

Here is a sample of the ASP file which are problematic....

   <TD width="109" valign=top align=left><map name="FPMap0">
      <area href="AboutWEBView.htm" shape="rect" coords="19, 3, 94, 23">
      <area onClick="MM_showHideLayers('layer1','','show')" shape="rect" coords="20, 29, 93, 49">
      <area href="RSViewWEB.asp?Tags" shape="rect" coords="18, 53, 92, 73">
      <area href="RSViewWEB.asp?Alarms" shape="rect" coords="18, 78, 92, 99">
      <area href="default.htm" shape="rect" coords="18, 104, 93, 124">
      <area href="HelpWEBView.htm" shape="rect" coords="19, 131, 94, 152"></map><img border="0" src="RSImages/Left.gif" width="108" height="264" usemap="#FPMap0"></TD>
    <TD width="100%" height="100%" valign=top align=left>
*            <% Set rsview = Server.CreateObject("RSWEBServer.Object.1") %>
*            <% rsview.RSWEBServer() %>
*            <% Set rsview = Nothing %>
    </TD>

I denoted the lines I think are the problem with an *.

When I browse the page and view the source code, here s what the above lines show:

    <TD width="109" valign=top align=left><map name="FPMap0">
      <area href="AboutWEBView.htm" shape="rect" coords="19, 3, 94, 23">
      <area onClick="MM_showHideLayers('layer1','','show')" shape="rect" coords="20, 29, 93, 49">
      <area href="RSViewWEB.asp?Tags" shape="rect" coords="18, 53, 92, 73">
      <area href="RSViewWEB.asp?Alarms" shape="rect" coords="18, 78, 92, 99">
      <area href="default.htm" shape="rect" coords="18, 104, 93, 124">
      <area href="HelpWEBView.htm" shape="rect" coords="19, 131, 94, 152"></map><img border="0" src="RSImages/Left.gif" width="108" height="264" usemap="#FPMap0"></TD>

    <TD width="100%" height="100%" valign=top align=left>
            <p><img src="http://10.10.0.100/rsviewweb/RSImages/RWV45.jpeg" width="1020" height="730"></p><META HTTP-EQUIV="REFRESH" CONTENT="10">
<table width="100%%"><tr><td class="date" width="100%%">Friday, September 28, 2007 12:19:59</td></tr></table>
    </TD>

The problem is that http://10.10.0.100 which should be something.dyndns.org

Is there some type of replace function I could use in the ASP script to automatically change the results?

Many thanks for any help.
0
Comment
Question by:dannyd_imalog
  • 5
  • 2
7 Comments
 
LVL 9

Expert Comment

by:CCongdon
ID: 19980396
Hmmm, that's tough. Because the way your code appears written, it means that the rsview.RSWEBServer() is what is actually doing the screen outputs. What about the source data? Is there a place to change the IP address in there somewhere?

Because it's output directly from an object, you need to find if there are other Methods/Properties of that object or if there is an ability to modify the object.

0
 
LVL 9

Expert Comment

by:CCongdon
ID: 19980423
Another possibility, and this is extreme...you could add some javascript code that executes right after the picture is displayed that changes the source of the photo. I can get back to you in a little bit with that javascript. The problem with that approach is that not everybody's browser will execute it. It would be much better if the output could be changed server side.
0
 
LVL 1

Author Comment

by:dannyd_imalog
ID: 19980434
Yes, that seems to be what is happening, rsview.RSWEBServer() is generating the code and there is absolutely no where to change IP address or anything.

I tried this, the code works, but doesn't replace the 10.10.0.100....I guess it wasn't going to be that simple.

            <% Set rsview = Server.CreateObject("RSWEBServer.Object.1") %>
            <% sMyString = rsview.RSWEBServer()%>
            <% sMyString = Replace(sMyString,"10.10.0.100","imalog.dyndns.org")
            Response.Write sMyString%>
            <% Set rsview = Nothing %>
            <% Set sMyString = Nothing %>

I have no clue what else to do....
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 9

Accepted Solution

by:
CCongdon earned 2000 total points
ID: 19980474
<script type="text/javascript">
var imgs=document.getElementsByTagName("img");
for (var i=0;i<imgs.length;i++) {
    imgs[i].src = imgs[i].src.replace("10.10.0.100","something.dyndns.org")
}
</script>


This does seem to work after some testing. Be aware however that the page will still try to load images. For best performance, you should put this script at the end of the page, because you will get unexpected (or no) results if put in the middle of a table.
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 19980500
Caveats on my script approach:

1) Some people are paranoid and turn off javascript.
2) Some security software is paranoid and turns off javascript.
3) This method will still cause the image at the bad URL to try and load. This might cause delays in page load before the corrected image pops up.
0
 
LVL 1

Author Comment

by:dannyd_imalog
ID: 19980524
Hi CCongdon......I agree with the list of caveats, but at least it solves my problem on a short term basis.

I really appreciate your help......although I would have loved to be able to alter the return from rsviewRSWEBServer(). On a side note, any ideas or incite as to why the replace function wouldn't work on something like that? I am a newbie and any help is appreciated.

Thanks again.
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 19980526
I've been playing with some server-side ideas, but I can't get anything to work. Since I don't have your actual object, I just created a class inside my script with a public function that Response.Write("10.10.0.100").

Here's something interesting I saw...

Response.Write("OUTPUT: " & rsview.RSWeb())

That line gave me the following output:

10.10.0.100OUTPUT:

Actually it does make some sense...and it is why you can't get anything to work. The script processor has to evaluate all expression inside the Response.Write before executing the write. Since the class's method has a Response.Write in it, this executes first before the line that called it finishes executing.

Seriously though, if you don't mind the little hack job I gave you it does seem to work. :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question