Showing posts with label downloaded. Show all posts
Showing posts with label downloaded. Show all posts

Saturday, March 31, 2012

Sendkeys not declared?


I just downloaded ASP.Net Web Matrix and I'm really enjoying using it, even though I only know what I am doing about 10% of the time. The one problem I've encountered is that I can't get a VB "SendKeys" statement to work in an ASPX page. I have a really simple script written. Here it is:
Sub Button1_Click(sender As Object, e As EventArgs)
Shell ("notepad", 1)
SendKeys ("%", True)
End Sub
The button code is:
<form id="form1" runat="server">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</form>
When I run the page, it returns an error that states: "SendKeys statement not declared." Originally, I had no parentheses around "%, True," but ASP.NET demanded it so I put it in. Any help would be greatly appreciated. I am SendKeys-dependent.

Hi,

In .NET SendKey is a class declared in System.Windows.Forms namespace. You can use it as follows:

SendKeys.SendWait("%")

But... It is really not a good idea to open notepad at server from ASP.NET application. Is this what you intend to do?


Thank you so very much for your response. I am continuing to get the same error message, even after adaptation of the command to Sendkeys.Sendwait:

"Compiler Error Message:
BC30451: Name 'SendKeys' is not declared."

I had previously located Sendkeys as an identified namespace within System.Windows.Forms, but I am not sure what to do with that information beyond that. Is there something I need to do to get the page to "talk" with that class or namespace?

As for your caution, I appreciate it. Have read the warnings. The application is going to run only on my PC. Does that minimize the concern?
Again, thank you for your time.


Hi,
You have to reference System.Windows.Forms.dll to use this method.
I think what you want to do is to open notepad from client script and not from server side code. You can use scripting host to do it. In vbscript it will look like this:
Dim WshSHell
set WshShell = CreateObject("WScript.Shell")
WshShell.Run("notepad")
WScript.Sleep(100)
WshShell.AppActivate("Notepad")
WScript.Sleep(100)
WshShell.SendKeys("abc")

Sensing failed downloads

Is there any way to determine that a user received a downloaded file. I'm
developing a service that sells documents (like PDF books) and I need to
have a way to determine if the buyer actually got the document. Is there
any way to determine is the client received the full download?

--BuddyOne crude way that comes to mind is using the IIS log or a custom app log:
Capture the buyer's host IP address and then search the log for a GET on the
that address, date, document name and a status code of 200.

2004-04-08 23:33:08 W3SVC1 SERVER5 233.81.31.14 GET /pulbicdocs/MyDoc.pdf -
80 - 154.199.45.213 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) -
mycompany.com 200 0 64

I'm sure there are more elegant ways to accomplish this task but that will
probably work.

HTH.

- Assaf

"Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
> Is there any way to determine that a user received a downloaded file. I'm
> developing a service that sells documents (like PDF books) and I need to
> have a way to determine if the buyer actually got the document. Is there
> any way to determine is the client received the full download?
> --Buddy
That doesn't necessarily guarantee that the whole file was downloded though
does it? Also I hsould have pointed out that the file is not being access
directly. I have and ASP.NET page that reades and attcahes the file to the
response. Here's what I'm doing.

response.contenttype = "application/pdf"
header = "attachment;filename=" & filename
Response.AddHeader("Content-Disposition",header)
Response.WriteFile(FileName, StartPos, FileSize)

Anyway to know that the download has been interrupted?

--Buddy

"Assaf" <at@.isp.com> wrote in message
news:uaE0b6YIEHA.3444@.TK2MSFTNGP11.phx.gbl...
> One crude way that comes to mind is using the IIS log or a custom app log:
> Capture the buyer's host IP address and then search the log for a GET on
the
> that address, date, document name and a status code of 200.
> 2004-04-08 23:33:08 W3SVC1 SERVER5 233.81.31.14 GET
/pulbicdocs/MyDoc.pdf -
> 80 - 154.199.45.213 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) -
> mycompany.com 200 0 64
> I'm sure there are more elegant ways to accomplish this task but that will
> probably work.
> HTH.
> - Assaf
> "Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
> news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
> > Is there any way to determine that a user received a downloaded file.
I'm
> > developing a service that sells documents (like PDF books) and I need to
> > have a way to determine if the buyer actually got the document. Is
there
> > any way to determine is the client received the full download?
> > --Buddy
Hi buddy,

I do not believe that is possible to be a 100 percent sure of this.

Consider the use of proxy servers

A lot of users may be connected using a proxy server and it might be
possible for this server to continue and finish the download, long after
your user has "crashed" his machine, or interrupted the download in any
other way.

Maybe an email to the user with a reporting service for download errors
could help you out.

Evert

"Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
> Is there any way to determine that a user received a downloaded file. I'm
> developing a service that sells documents (like PDF books) and I need to
> have a way to determine if the buyer actually got the document. Is there
> any way to determine is the client received the full download?
> --Buddy

Sensing failed downloads

Is there any way to determine that a user received a downloaded file. I'm
developing a service that sells documents (like PDF books) and I need to
have a way to determine if the buyer actually got the document. Is there
any way to determine is the client received the full download?
--BuddyOne crude way that comes to mind is using the IIS log or a custom app log:
Capture the buyer's host IP address and then search the log for a GET on the
that address, date, document name and a status code of 200.
2004-04-08 23:33:08 W3SVC1 SERVER5 233.81.31.14 GET /pulbicdocs/MyDoc.pdf -
80 - 154.199.45.213 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) -
mycompany.com 200 0 64
I'm sure there are more elegant ways to accomplish this task but that will
probably work.
HTH.
- Assaf
"Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
> Is there any way to determine that a user received a downloaded file. I'm
> developing a service that sells documents (like PDF books) and I need to
> have a way to determine if the buyer actually got the document. Is there
> any way to determine is the client received the full download?
> --Buddy
>
That doesn't necessarily guarantee that the whole file was downloded though
does it? Also I hsould have pointed out that the file is not being access
directly. I have and ASP.NET page that reades and attcahes the file to the
response. Here's what I'm doing.
response.contenttype = "application/pdf"
header = "attachment;filename=" & filename
Response.AddHeader("Content-Disposition",header)
Response.WriteFile(FileName, StartPos, FileSize)
Anyway to know that the download has been interrupted?
--Buddy
"Assaf" <at@.isp.com> wrote in message
news:uaE0b6YIEHA.3444@.TK2MSFTNGP11.phx.gbl...
> One crude way that comes to mind is using the IIS log or a custom app log:
> Capture the buyer's host IP address and then search the log for a GET on
the
> that address, date, document name and a status code of 200.
> 2004-04-08 23:33:08 W3SVC1 SERVER5 233.81.31.14 GET
/pulbicdocs/MyDoc.pdf -
> 80 - 154.199.45.213 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) -
> mycompany.com 200 0 64
> I'm sure there are more elegant ways to accomplish this task but that will
> probably work.
> HTH.
> - Assaf
> "Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
> news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
I'm
there
>
Hi buddy,
I do not believe that is possible to be a 100 percent sure of this.
Consider the use of proxy servers
A lot of users may be connected using a proxy server and it might be
possible for this server to continue and finish the download, long after
your user has "crashed" his machine, or interrupted the download in any
other way.
Maybe an email to the user with a reporting service for download errors
could help you out.
Evert
"Buddy Ackerman" <buddy@.buddyackerman.com> wrote in message
news:OQekjfYIEHA.3840@.TK2MSFTNGP11.phx.gbl...
> Is there any way to determine that a user received a downloaded file. I'm
> developing a service that sells documents (like PDF books) and I need to
> have a way to determine if the buyer actually got the document. Is there
> any way to determine is the client received the full download?
> --Buddy
>