Trigger action in C# executable from web application

Hello,

We have this web application (it's developed in C#, but that really
does not matter), and part of it's functionality is to print some data
on a specific kind of printer that's attached to the user's PC. The
printer will print if a file to print is placed in specific configured
folder in the PC's local file system. So the web app that resides in
the browser, pretty ignorant about the PC where it is running on,
needs to trigger a local process that will result in the file created
in the needed place.

Right now we go with rather heavy solution - a local webserver is
installed and the web app passes the data to local URL, and the tiny
script does it's thing - collects the data and creates the file in the
needed place.

I am now wondering if we could set it up in more elegant way:
1) Have a local C# app triggering regularly far web server "is there
anything for printing".
- pros: seems simple to implement
- cons: regular far webserver triggering sounds like bad architecture.
Also delays could be a problem.
2) Have a local C# app that acts as simple http server
- pros: sounds like the most direct way to pass down info to local app
from the browser
- cons: potential security problems? Could be complex to develop?

Maybe there is some other smart idea how a local process can be
triggered from a web app?

Passiday
0
Passiday
12/8/2009 10:43:36 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

3 Replies
992 Views

Similar Articles

[PageSpeed] 37

Passiday wrote:
> [...]
> I am now wondering if we could set it up in more elegant way:
> 1) Have a local C# app triggering regularly far web server "is there
> anything for printing".
> - pros: seems simple to implement
> - cons: regular far webserver triggering sounds like bad architecture.
> Also delays could be a problem.
> 2) Have a local C# app that acts as simple http server
> - pros: sounds like the most direct way to pass down info to local app
> from the browser
> - cons: potential security problems? Could be complex to develop?
> 
> Maybe there is some other smart idea how a local process can be
> triggered from a web app?

Why does it have to be a local process other than the web application? 
Can a web application not print?  I see Javascript-based pages print all 
the time (or at least, invoke the print dialog so the browser can 
print).  And I've seem web applications that can download and save files 
to my computer, so how is it that your web application cannot be 
designed to somehow place a file in the correct place?

(These are rhetorical questions...I don't personally need an answer to 
them, I'm just asking them as a way of prompting some thought along 
those lines).

It seems to me that you really should be asking your question in a 
newsgroup where questions about web applications are specifically 
on-topic.  There you may find advice from someone who knows how your web 
application can directly handle the printing needed, rather than using 
an independent process the web application needs to communicate with.

Barring that, certainly I'd agree that having a local program with which 
the web application can communicate directly is much better than having 
the web application notify a remote server that the local program is 
polling on a regular basis.

As far as security problems go, I suppose it's true that any time you've 
got a process running that can accept data from an external source, 
there's a potential for issues.  But using .NET, hopefully the biggest 
threat would be some kind of denial-of-service or abuse-of-service, and 
if you accept requests only from local IP addresses, that should be 
minimized.

If I were you, I'd post my question to a more relevant newsgroup, and 
see if there is better advice from people actually writing web 
applications on a regular basis, including the possibility that someone 
can explain to you how to get the printing to work without a separate 
process at all.

Pete
0
Peter
12/9/2009 12:51:50 AM
If this is an intranet solution, you could investigate using using an HTA 
version of your web app.  That way it will have access to the local 
filesystem. It could poll the webserver for the file info and do the writing 
itself.

http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx

Tim

"Passiday" <passiday@gmail.com> wrote in message 
news:fb546406-8a7a-4723-b8cb-8fc64a46bebc@a21g2000yqc.googlegroups.com...
> Hello,
>
> We have this web application (it's developed in C#, but that really
> does not matter), and part of it's functionality is to print some data
> on a specific kind of printer that's attached to the user's PC. The
> printer will print if a file to print is placed in specific configured
> folder in the PC's local file system. So the web app that resides in
> the browser, pretty ignorant about the PC where it is running on,
> needs to trigger a local process that will result in the file created
> in the needed place.
>
> Right now we go with rather heavy solution - a local webserver is
> installed and the web app passes the data to local URL, and the tiny
> script does it's thing - collects the data and creates the file in the
> needed place.
>
> I am now wondering if we could set it up in more elegant way:
> 1) Have a local C# app triggering regularly far web server "is there
> anything for printing".
> - pros: seems simple to implement
> - cons: regular far webserver triggering sounds like bad architecture.
> Also delays could be a problem.
> 2) Have a local C# app that acts as simple http server
> - pros: sounds like the most direct way to pass down info to local app
> from the browser
> - cons: potential security problems? Could be complex to develop?
>
> Maybe there is some other smart idea how a local process can be
> triggered from a web app?
>
> Passiday 


0
Tim
12/9/2009 5:21:36 AM
"Passiday" <passiday@gmail.com> wrote in message 
news:fb546406-8a7a-4723-b8cb-8fc64a46bebc@a21g2000yqc.googlegroups.com...
> [...]
> 2) Have a local C# app that acts as simple http server
> - pros: sounds like the most direct way to pass down info to local app
> from the browser
> - cons: potential security problems? Could be complex to develop?

    This is easy to develop if you download the code for the Cassini web 
server, which you can add to your project and compile together with your 
application:
http://www.microsoft.com/belux/msdn/nl/community/columns/desmet/hostaspnet2.mspx

    The original Cassini only accepts connections from the local machine, 
buut since you have the source code you can search the one line where it 
performs this check and remove it. Or better yet, change it so that it only 
accepts connections from your web server; this should alleviate some of your 
security concerns.

0
Alberto
12/9/2009 7:57:56 AM
Reply:

Similar Artilces:

Open Outlook veiwer in my application
Hi, I want to open MicroSoft Outlook Veiwer in my application(using visual studio.net). How can i do this? Please define Microsoft Outlook Viewer? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After furious head scratching, Mallikarjun asked: | Hi, | I want to open MicroSoft Outlook Veiwer in my application(using visual | studio.net). | How can i do this? The Outlook View Control, which is included in OL2002/3 and a ...

Import from web query problem
When importing from a web query the cell value <10E 6/L or <10^ 6/L does not import ie target cell is blank. Same happens whether the middle space is left in or out. Cells such as <100 import OK. Any suggestions as to what is happening here would be appreciated. Thanks. ...

how to run other application from ur program
dear friends, i m new to MFC ,but i want to open application like notepad using MFC . i want to send window messages like VK_LWIN VK_UP VK_UP and certain no of other messages to open any other application. how is it possible. Seems like you want a CreateProcess() function. Read about the parameters you provide for this program. You may also use a very simple function ShellExecute(), but it may not give you much flexibility like a control over the process you're creating. Here is an example of opening notepad.exe: ShellExecute(NULL, "open", "notepad.exe", GetPathName...

MFC based client server application query?
Hi experts I have developed an client server application using MFC sockets support. The server is a dialog based application & the client is an SDI application. I am having problem with sending data from client to server. After starting the server application, i start the client and try to connect & send data to server using the following code. void CMainFrame::OnConnect() { CSimpleSDIsockclientApp *pApp = (CSimpleSDIsockclientApp*)AfxGetApp(); int res = pApp->ClientSocket.Create(40000); if(res) { MessageBox("Client Socket at port no. 40000 Successf...

C++ programming for sql notification services (sql2000)
has anyone does this .... i would like the sample code of it .... tried google .. but no clues .... plz help forgot to mention ... i would not be using .net classes ...... "Mubashir Khan" <mubi@yahoo.com> wrote in message news:enrtW1mCHHA.4312@TK2MSFTNGP06.phx.gbl... > has anyone does this .... i would like the sample code of it .... tried > google .. but no clues .... plz help > ...

Web Query Not Working
Up until yesterday, my web query in my Excel worksheet has been working perfectly. I have been using the saved query named "Microsoft Investor Stock Quotes.iqy". It looks like the server accessed by the URL has been down. When I ping the domain, I get the message that the ping timed out. The link used by the query is http://investor.msn.com/external/excel/quotes.asp?SYMBOL=AA,fdx... Is anyone else experiencing the same problem? Does anyone know how to contact MSN to jog them to get things up and running? Or, have they stopped supporting the query? Gary Mine went d...

Web Client marking messages read
Need help with Blackberry web client marking messages read when it copies messages from Web mail. I just brought up about 15 blackberry 7230s using T-Mobile as a carrier. We are using Exchange 5.5 and have web mail setup. I am getting the mail messages to go to blackberry devices, but the messages are being marked as read in Exchange/Outlook. Basically, when the users are sitting at their desks their messages are being marked as read even though they haven't read the messages. I saw some kind of fix for Exchange 2000, does anyone know if there is anything I can do other than...

How To Add Streaming Video to your web-page
Adding Streaming video to your web-page is as simple as a few clicks of the mouse with this amazing tool. http://www.ebvalues.com ...

vc++ 6.0 application runs on windows 20003 (64 bit CPU 32 bit OS)
Hi I have a VC++ 6.0 application runs on windows 20003 (64 bit CPU and 32 bit OS), it does not work. The same application runs fine on Windows XP and Windows 2000. When I debug it with VC++ 6.0, the break points and the source code totally messed up. I have a if else statement, the debug goes from inside if goes to else block if (...) { ....................... } else { ............... } Does any one have any idea about this? Thank you for your help There is no content whatsoever in the phrase "does not work". There is always a specific statement as to why something do...

Multilanguage support in MFC application
Hello, I’m looking for a library/tool to add multilanguage support to my MFC application. The different translations must be based on a text file, one for each language. There are many application (IZArc for instance) that employs this solutions. Anyone knows or use something like this? Thanks. It is possible to embed different language UIs into the application's RC file, but I prefer to create a single RC file for each language then use Visual Studio to build them into resource-only DLLs. When the user selects a language, the application dynamically loads the corresponding DLL...

Validating enumeration of a schema using XmlReader / XmlDocument . c#
Hello, I am validating a xmlDocument in .net using XmlReaderSettings , XmlReader and the .Validate method of XmlDocument. The validation is working properly except for the fact I am receiving no errors when the values do not match the enumeration defined in the Schema. Is there a setting I can modify to force validation on the values defined in the enumeration. ex. If I pass in 5, I do not receive an error or warning. <xsd:restriction base="xsd:string"> <xsd:enumeration value="1" /> <xsd:enumeration value="2" /> <xsd:en...

Application or object defined error
Hi, When I run the following code, I am getting the Application or object defined error. The second line is a single line in my code. The VBE highlights the portion after "Then" in the second line. Sub Cleancolumn1() For i = 1 To ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count, 14).End(xlUp).Row If Left(Cells(i, 14), 1) = "'" Then ThisWorkbook.Worksheets("Sheet1").Cells(i, 14) = Right(Cells(i, 14), Len(Cells(i, 14)) - 1) Next i End Sub What is going wrong? Thanks in advance for the help. Regards, Raj Hi Raj Do you mea...

XmlTextReader and C# using statement
Is it possible to use the using statement with XmlTextReader? I tryed to use it, but it gives me the error message: Cannot implicitly convert type 'System.Xml.XmlTextReader' to 'System.IDisposable' Is there something I am doing wrong? // This no worky using(XmlTextReader xtr = new XmlTextReader("C:\\myfile.xml")) { // Do something } No. You're not doing anything wrong. You can only use the using statement with classes that implement the IDisposable interface. The XmlTextWriter doesn't implement that interface, hence the error message. The work...

Protecting pictures on the web
Can anyone help? I am building a web site using Publisher 2003, for my wife who is an artists. I want to put a selection of her paintings on the web site, but I want to stop people saving them and printing them out. Is there any way I can do this? thanks in advance for any help Peter Cripps Hi Peter Cripps (Peter.Cripps1@btopenworld.com), in the newsgroups you posted: || Can anyone help? I am building a web site using Publisher 2003, for || my wife who is an artists. I want to put a selection of her || paintings on the web site, but I want to stop people saving them and || printing them ou...

Extranet Configuration of project web access
I have installed Microsoft EPM with in two server installation. and now I need to configure extranet environment . but I am confused to understant host header , load balance url , alternate access mapping. I extended my web access site . but further what i need to do . then my site will be an accessible from anywhere. I am bit confused. although I study technet pages . but confused kindly tell me step by step. Kindly tell me the solution as soon as poosible. Regards Hello Sam. Hopefully this link will help explain some of those keywords and how you go about configuring ...

Downloading Msgs From Outlook Web Access to Local HDD
Hey Everyone, I just got assaigned an email account for college next fall. Their method of checking email is Outlook Web Acess. I find this program extremly difficult to use and was wondering if it's possible to download the messeges from my account to my HDD using a program like Thunderbird or possibly Outlook Express? I tried connected via POP method- using mail.SCHOOL.edu as my incoming mail server and smtp.SCHOOL.edu as my outgoing mail server. Is it my school that is the problem or is it simply impossible to download msgs from Web Access? Thank You! -Oyster Outlook Web Access i...

Unable to C/R external DB
I have written an app that has a fairly large amount of data, so I've split out some of the tables into separate databases, to avoid Access's 2GB file size limit. I use linked tables to get at the data and the app works great. My problem is when I initially populate the tables, I want to C/R the db afterwards. Updates happen very rarely, mostly it's a read-only app. There are three databases in use here, the app, which contains some working tables and two external Acces .MDB files, which contain all the data. After populating or updating the external tables, I use th...

Can't print web documents
If I open a document from, say, http://www.domain.com/document.xls, using the address field in Outlook's Web toolbar, print is not available. Open the same document in Internet Explorer and print is a viable option. This happens with any Office document. However, print feature works fine with any other type of documents - .pdf files work with no problems. Any suggestions? ...

HTTP Error 405 when trying to send email from Action in CRM V1.2
When trying to send an email using the Action method from a Services Case, it returns this error: `````````````````````````````````````````````````````````````````````````` Error Description: An unexpected error occurred. Error Details: An error occurred attempting to dispatch the email : HTTP status: 405 Error Number: 0x80040216 Source File: D:\crm\Build\3297\src\platform\include\proxy\proxyutil.h Line Number: 47 Date: 04-25-2007 Time: 5:16:56 PM Type: Platform Error (2) Server: 66.45.4.130 Query String: /Activities/Email/edit.aspx&pId={95068BCD-D3AD-46A9-968C- FCF19C0CEDB4}&am...

Interactive Web Frame Size
Does anyone know of a way to increase the size of the Excel spreadsheet that is displayed in the web page when a file is saved as a web html and interactive is selected? I would like to be able to see more of the Excel spreadsheet without scrolling within the Excel window. Any ideas? Thanks, Christi ...

I get an error message on outlook cannot connect with web server .
alll of a sudden I caan't update the calendar I posted on office live. It says outlook cannot connect to web server? I downloaded the recent share point server after this message, but it is still happening....help. Known issue - Go to office.com and sign in with the same Live ID you use to publish your calendar and select "Save my e-mail address and password". Restart Outlook and the browser. It should now work for either publishing or updating a subscribed calendar, at least until you sign out of Office Online and/or LiveID. I’m not sure what the secret is - ...

Our Application Makes Call to Mapi32.dll
This may take a while to convey so please continue reading and bear with me. We are currently evaluating automated testing software: QA Wizard Pro. For the most part, it seems to be OK, but we've run into a sort of snag. With this testing software, you can connect to an already running application from within their scripting capabilities. Our application contains an email option, which then displays an outlook mail window. When this occurs, there is an Outlook.exe process listed in Task Manager -> Processes, but Outlook does not appear to be a running Application in Task Manager. A...

"Microsoft CRM Applications Professional v. 1.2" -- Guidence
Hi, I have planned to take MSCRM1.2 exams, Any one who has finished "Microsoft CRM Applications Professional v. 1.2", pls tell me the following details. what is the question pattern ? areas to be concentrated ? is there any programs to be written in the exam ? any model questions ? will there be any questions from installation of MSCRM ?(since it has seperate exam) what level of hands on experience is important to clear this exam ? is there any moc exams available ? Thanks in advance. Regards, You need to be totally familar with the entire application as it focuses more on funct...

VC Application to access network path file
Hi, all I have a question, my boss told me to write a application to run in a computer to access a file saved in a netwok path, but the computer do not have the permission to access that remote path, my boss's suggestion is : the App can create a connection by sending valid username and password ,and then can access that remote file. but the computer always can not access that network path. could anybody give me some helpful suggestions, thanks in advance! -jos I think your boss tolds you to use WNetAddConnection2. -- WebSite : Realization of Dream { imagine your dream} ...

CRZY SLOW! Every folder I click on, it's at least 1-2 mins to c em
Every folder I click on, it's like at least 1-2 minutes before I see a message on the screen. I imagine maybe it's because I have a lot of messages? I have about 20 e-mail accounts, and probably get about 50-60 messages an hour. (most are business accounts, and I get about 75% spam, which does get filtered & deleted, but still is there) So is that why it's just snail slow? Because I have so many messages? I try & move most of them ot the storage folders, but still, if I go to a folder that has more than like 50 messages in it, it takes minutes to load &...