Accessing a windows application form from an ASPX page - asp.net

I have an aspx page and I want to access an application on the client after seeking user permission. Both the windows application and the website are to be made in VB.NET. Does any one have any idea as how to go about solving this problem?
Thanks
EDIT:
Here is the problem. From my .aspx webpage in vb.net, a visitor clicks on a link on my site, and if my winform is not already loaded on their desktop, it is then loaded with the users permission. This application should auto-load on the user's site at boot up time and always be in the background running. Make it an extremely thin client, taking the least cpu and bandwidth from the user, and running as a silent background process until needed.
Whenever the user visits one of my many websites, IN ANY BROWSER, somehow - the app running in the background communicates with the .aspx on one of my sites, and exchanges a silent username password identifying client winform app to the online .aspx app on my website.
Then the .aspx on my site PASSES a url such as "www.somewebsite.com" to the app running in the background, the background app then does a http request from the client's computer, not from my .aspx server, so the client's cookies and ip are visible to "www.somewebsite.com" server. The client collects the html for that page, stores it as a string, and also saves the ascii of that webpage as another string.
Both strings then are PASSED BACK to my .aspx website that the client is visiting, and the .aspx app then stores these results in a database.

I don't see anyway your web page can access/execute an executable from a client's hard drive. May be with RIA components (Silverlight, Flash, etc), but not sure. You could however register a protocol like myapp: on client when installing your windows app to that machine and invoke a url from the web using that protocol with appropriate data passed as arguments. Then it's up to the windows app to communicate to the server and get the things done. Here is an MSDN article to get you started.

The only somewhat similar thing I've done like this is launching and manipulating Outlook from within a webpage, by generating the necessary VbScript. This of course implies that your users will only use IE to access your website.
Set olApp = GetObject(, "Outlook.Application")
Set objFolder = olNs.GetDefaultFolder(oCalendarDefault)
Set MyItems = objFolder.Items
etc

Related

What role does a web sever play in hosting of single page applications

As per my understanding, when user visits a url of a SPA application, the whole application is downloaded including any static html,assets and javascript. Can someone please clarify what role does the host web server play from there on? If after download of all the assets, I turn off the web server the application does not work. But ideally, it should work because now all the code to create any views is with the client already in form of javascript files. Let's assume there are no API calls for data.
Yeah it will work
If the application is fully loaded in browser it will work even after you turned off or disconnect the web server
Web Server No Need after the client has downloaded all the assets

Ways to get file generated on user's PC from browser information without user input

I have a web application on a public facing web site that requires a username and password to log into. Users log in from locations in many different countries and depending on their login location different settings are applied.
Certain users have asked for integration from this web application to another running on the same machine as they are using. They require an XML file to be saved down to a specific folder whenever a transaction occurs on the web application. They don't want the user to have to click any button or have a save dialog appear.
Obviously this is not possible using normal browser functionality for security reasons. What I want to know is this: is it possible to write some application or service that runs on those users' computers that could somehow take the transaction information from the browser and generate the file? I can modify the web application to know when it needs to do this so there can be work on both ends.
One way of doing this that I was thinking of was to have a web service running locally on all PCs where this is required, and the application will call this service when required.(e.g. a localhost url that would be setup on all required pcs ) Has anybody any other suggestions?
I’m not an expert on programming but I don’t think that would be possible. It would create a security risk and if it were possible then anyone could have it download a virus to your computer.

ASP.NET Silverlight New Tab Session empty (keys missing)

Scenario: My general portal is hosted in IIS using ASP.NET and a login page. After successful login via WCF service, the session token is stored in the HTTPContext.Current.Session under mytoken.
The portal page hosts a Silverlight app in an iframe. The SL app opens a new tab using System.Windows.Browser.HtmlPage.Window.Navigate().
The tab is supposed to offer a file for download. The page called is an aspx page. It accesses HTTPContext.Current.Session["mytoken"] to get the current session token.
This works fine at all my customers except one.
Problem: At this one customer, the download tab gets null from HTTPContext.Current.Sessions["mytoken"]. I added a trace to confirm that. It does not work in either IE or Firefox.
The download page works fine when called on the web server directly. And each customer has a very similar setup and it works everywhere but at one site.
Does anybody know what to look for? How can the session be shared at all sites except one?
Thanks for any help!
We found the reason for our problem. It had something to do with using the IP address and/or the machine name in the URL.
It does not work if the portal uses http://machine1/portal/main.aspx and the new tab uses http://123.345.789.123/portal/download.aspx. Or the other way round. It seems that the session is not shared in that case, even though the IP address is the one belonging to the machine name.
I had the base URL for the download link hard-coded in the configuration of the SL app. So it did not build the download aspx's URL dynamically based on its own root URL.
I am now using Application.Current.Host.Source and its properties Source, Scheme and Port to construct the base URL on the fly in the Silverlight cllient.
Everything works like a charm now.

How can I find a given window on the client computer and activate it from ASP.NET

Running a website from asp.net, I need to transfer control (focus) to a winforms application.
In case the application isn't running, I know I can use process.start() method.
But in case the application is running, I don't want to launch a new window.
I have the option to setup the winform application as unique instance, but what if it is a foreign application? I mean if I'm NOT the author and have no control over launching new instances...
How can I find a given window on the client computer and activate it from ASP.NET
Due to security reasons you cannot do it. Code inside browser doesn't have access to user system.
If the browser is Internet Explorer, you could host a .Hta page (or return a content type: application/hta ).
A .Hta page is fully trusted, and can access everything on your local machine through COM. So if can you do it with VBScript, you can do it in a .Hta page.
The user has to trust this "application" before it is downloaded. If this is an Internet application you will probably not get this trust. If this is an Intranet application, you can force the user to trust the page.
I suppose if this was a bit of functionality you really needed you could go down the ActiveX route. Having said that it would only work in IE and would require a separate plugin for firefox (or other brothers) to function.
Honestly though it sounds like overkill for what you are trying to achieve.

ASP.NET gone FUBAR on a production machine

Today we tried to put an ASP.NET application I helped to develop on yet another production machine. But this time we got a very weird error.
First of all, from all the ASP.NET pages, only Login.aspx was working. The rest just show a blank screen when they should have redirected to Login.aspx. The HTTP response is 200, but no content.
Even worse - when I try to enter the address of some inexistent ASPX page, I also get HTTP 200! Or, when I enter gibberish in some existing ASPX page code (which should have been accessible without login) I also get HTTP 200.
If I enter the name of some inexistent resource (like asdasd.jpg), I get the expected 404.
The redirect to login page is written manually in Global.asax. That's because the application has to use some alternate methods of authentication as well, so I can't just use Forms Authentication. I would suspect that Global.asax is failing, if not for the working Login page.
Noteworthy facts are also that this machine is both a Domain Controller and has SharePoint installed on it. Although the website in question is listed in SharePoint's exception list.
I would check the following:
Is the application within a virtual application or its own site and not just a virtual directory?
Does the application have it's own App Pool? If it does not then is the app pool shared by apps in a different .net version.
Is the .net version of the application the correct one? 1.1 or 2.0?
Do the files in the file system have the correct permissions to be accessed via IIS?
Have you performed an IIS Reset?
Create a stand alone test.aspx page within your folder that just displays the date/time and check it works.
Make this single test.aspx page perform an exception (eg. divide by zero) and see what the outcome is.
More information required.
What Op Sys?
What mode IIS running under?
What version of .Net?
What version of SharePoint?
(Why are you using your DC as a web host?)
Does it work on the other production machines you've deployed to?
If so what is different between this machine and the working ones?
Did you deploy the same way?
Are you sure your hitting the right machine?
Are you sure your hitting the right web site?
What ISAPI components are installed globally and for the web site?
Is .aspx mapped to the ASP.Net ISAPI filter?
Do you have any HTTP Modules or HTTP Handlers configured?
Can you change the global aspx to write out some messages so you can be sure the piece of code you interested in is reaching?
Anything coming up on the IIS log or the event logs?
Addition:
What version of .Net?
By the sounds of it the .jpg request is being dealt with by IIS directly which is why you get the 404, but the .aspx request is being dealt with by something else which except for you login page, is always returning 200.
Assuming .aspx is wired correctly to .Net the the order of processing is based on ISAPI filters (high to low then global before site), then the ASP.Net ISAPI Extension (sorry I said this was a filter earlier but it's actually an extension). Then we get into the ASP.Net pipeline based on your .Net configs, and calls the HTTP Application (which includes your global.asax code), any HTTP Modules followed finally by a HTTP Handler. Your ASP.Net web forms are just fancy HTTP Handlers.
However, the request can be responded to and terminated from any point.
Since your code works on other machines though, I'm tempted to point a finger at SharePoint if it isn't installed on the working machines. Is this SharePoint 2007? That is also an ASP.Net application (I don't think 2003 was).

Resources