Please login or register.

Login with username, password and session length
Advanced search  

News:

The X10Hub (PiX10Hub) is here! Created by the Community, for the Community.:)% #:)

Author Topic: ASP.NET Can't get it to work from web  (Read 29883 times)

hector (newbie)

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
ASP.NET Can't get it to work from web
« on: July 23, 2005, 12:52:27 AM »

Can someone help me troubleshoot this?
asp.net code. The first two buttons work only
from the server using localhost... but not
when I acess the page from the web. also the
two last buttons dont do anything but when I
added them cause an error in the
aspnet_wp.exe whenever I click them. I am
running windows xp IIS 5.1. Thanks for the
help in advance
Logged

hector (newbie)

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: ASP.NET Can't get it to work from web
« Reply #1 on: July 23, 2005, 12:53:31 AM »

oops I forgot to attach the code here it is


<%@ Page Language="VB" AspCompat="true" %>
<script runat="server">

Sub A1on(Source As Object, e As EventArgs)
dim wshShell =
Server.CreateObject("WScript.Shell")
wshShell.Run ("cmd /c
AHSDK\bin\ahcmd.exe sendplc a1 on" ,1, true)
wshShell=Nothing
Response.redirect("control.aspx")
End Sub


Sub A1off(Source As Object, e As EventArgs)
dim wshShell =
Server.CreateObject("WScript.Shell")
wshShell.Run("cmd /c
AHSDK\bin\ahcmd.exe sendplc a1 off" ,1, true)
wshShell=Nothing
Response.redirect("control.aspx")
End Sub

Sub Button3_Click(sender As Object, e As
EventArgs)
dim x10 =
Server.CreateObject("X10.ActiveHome")
x10.SendAction("sendplc", "a1","off")
End Sub

Sub Button5_Click(sender As Object, e As
EventArgs)
dim x10 =
Server.CreateObject("X10.ActiveHome")
x10.SendAction("sendplc", "a1","on")
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
</p>
<p align="center">
<asp:Button id="Button1"
onclick="A1on" runat="server" Text="A1
On"></asp:Button>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button id="Button2"
onclick="A1off" runat="server" Text="A1
Off"></asp:Button>
&nbsp;
</p>
<p align="center">
</p>
<p align="center">
<asp:Button id="Button3"
onclick="Button3_Click" runat="server"
Text="off"></asp:Button>
&nbsp;
<asp:Button id="Button5"
onclick="Button5_Click" runat="server"
Text="on"></asp:Button>
</p>
</form>
</body>
</html>
Logged

dev_dave

  • Guest
Re: ASP.NET Can't get it to work from web
« Reply #2 on: July 27, 2005, 06:26:25 AM »

You might try settings permissions on the
directory and add the asp account to it.  I
would also fully qualify the directory...
it looks like you are shelling a relative
pathname.
Logged

hector (newbie)

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: ASP.NET Can't get it to work from web
« Reply #3 on: July 28, 2005, 11:37:25 PM »

I ended up getting this to work but I still
get the error most of the time I run a
command from the page. Its an eror with
aspnet_wp.exe

"aspnet_wp.exe has encountered a problem and
needs to close. We are sorry for the
inconvenience..."


Sub A1off(Source As Object, e As EventArgs)
dim wshShell =
Server.CreateObject("WScript.Shell")
wshShell.Run("cmd /c
AHSDK\bin\ahcmd.exe sendplc a1 off" ,1, true)
wshShell=Nothing
Response.redirect("control.aspx")
End Sub

I removed the code that actually calls the
acmd.exe as follows.

"Sub A1on(Source As Object, e As EventArgs)
dim wshShell =
Server.CreateObject("WScript.Shell")
wshShell.Run ("cmd /c
AHSDK\bin\ahcmd.exe sendplc a1 on" ,1, true)
wshShell=Nothing
Response.redirect("control.aspx")
End Sub"

What do you mean by fully qualify the
directory and how would I go about doing
that? Win XP Pro

By the way thanks for the help
Logged

dev_dave

  • Guest
Re: ASP.NET Can't get it to work from web
« Reply #4 on: July 29, 2005, 10:01:46 PM »

yea, i just meant to pass in like cmd /c
c:\ahsdk\bin\ahcmd.exe ... instead of
cmd /c AHDSK\bin\ahcmd.exe...
My reasoning behind that is that your
existing call seems to 'expect' that the
shell exec will 'start' in a certain
directory.

Logged

dev_dave

  • Guest
Re: ASP.NET Can't get it to work from web
« Reply #5 on: July 29, 2005, 10:03:49 PM »

ASP programs do not provide a nice 'home'
for activehome pro... your program is like
a protestor in china :) asp points to your
program and says 'you may speak now.. take
all of .02 seconds and i will drop you like
a hot potato.

Your problem 'could' be that they are
subroutines... if possible convert them to
functions which return say an integer and
make the last line just return a zero...
then your calling function will wait until
the function comletes... you might also add
a call to doevents()  possibly right after
the call to sendaction this should allow
your program to get some breathing room to
run.

Also, you are running classic asp in a
asp.net server and apparently you have your
web server configured to hide error
messages... the error message you provided
is a generic error message that tells you
nothing and is meant for non-developers.
Since this is classic asp i forget the
easiest way to do this but you might try
some ideas from the following pages :
http://www.aspfaq.com/show.asp?id=2109
Logged

dev_dave

  • Guest
Re: ASP.NET Can't get it to work from web
« Reply #6 on: July 29, 2005, 10:05:26 PM »

sorry for multiple posts... i had to break
it up to fit into some weird limit :

I think the ideal solution for controlling
activehome pro from a web page would
involve running a service to handle all
activehome actions, this service would be
able to keep the activehome object 'loaded'
instead of creating, using, and destroying
it on each button press... and you would
communicate with the service from your asp
page... asp servers don't like to keep
stuff around so they drop your object,
maybe before its done so you may have to
workaround that.  Services arent really
easy to do so you should probably try
doevent or sleeps first but i think there
is a sample c# service some guy released on
here you might be able to integrate with or
use as a basis if you go the (best/long)
way.
Logged

hector (newbie)

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 7
Re: ASP.NET Can't get it to work from web
« Reply #7 on: July 29, 2005, 10:54:30 PM »

Well that sheds some light on the subject.
Thanks for all the responses. I will try
those things out. I see what the reasons may
be so I will try some work arounds and might
just go to another language all together.
thanks again!!!
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.