I have windows application which consists of many forms.
Now I came across the situation where I want to make this application available online.
How to achieve such a result?
Actually that does not seem to be possible reason is that both domains are different and for different purposes. Browsers are developed to display HTML and not render windows forms. Secondly HTML will work in all OS even non windows.
Also even if you succeed in doing it it will work only on server and there is no way you can show windows form to the user via browser.
you might want to look into converting it to Silverlight 2.0 instead.
Related
I am using the new ASP.NET MVC 4 beta and am trying to create a system that mostly works with responsive design, but for one specific view I am using a mobile view to render a specific view for mobile devices.
My structure is simply that I have a Show.cshtml and following that I have a Show.mobile.cshtml.
If I make my site available from my dev machine through IIS Express this view displays correctly for iPad, iPhone, Android phones and mobile Opera, and it also works the same if I make a local publish to IIS 7.5 on my dev machine.
The problem comes when we deploy to a live server, we have tried deploying on two different servers. Then the mobile view will only be served to iPhones, no other mobile devices. This is consistently so. Our servers set up have been both Windows 2003/IIS6 and Windows 2008 R2/IIS7.5 and it works the same on both, only iPhone gets served the mobile view.
What might be the cause of this?
I have not added anything custom in global.asax for this.
UPDATE
After some more research it seems clear to me that the default behavior for DisplayMode and mobile views depends on the Request.Browser.IsMobileDevice flag. This flag in turn seems to rely on the .browser files that are in the Config/Browsers-folder of the .NET Framework folder.
On my dev machine I have different .browser files than those that are present on the servers I have deployed to. So far I have tried to deploy the ones I have on my machine in the App_Browsers-folder of the web app, but that did not fix my issue. Might this be the way to go?
This is not a complete answer to your question but I think it will still help.
ASP.NET is not very good at solving browser capabilities in my experience. So, I can recommend looking into 51Degrees.Mobi Foundation. Steven Sanderson has a nice blog post on that:
Using 51Degrees.Mobi Foundation for accurate mobile browser detection on ASP.NET MVC 3
I am not completely sure but you should be able to hook this up easily to ASP.NET MVC 4 DisplayMode infrastructure. Here is a good resource on that:
51Degrees.mobi and MVC4
I thought the solution I gave below was the answer (it worked for a brief moment), but it still switched to the wrong view after a while.
Like the rest of the internet, I installed 51 Degrees from Nuget
This is working perfectly, and is very easy to set up
(The below doesn't work for me, but maybe it does for you)
http://www.nuget.org/packages/Microsoft.AspNet.Mvc.FixedDisplayModes
Looks like it is a known bug: http://aspnetwebstack.codeplex.com/workitem/280?PendingVoteId=280
According to codeplex link above, remember to make sure of this :
For a small set of projects that customize the list of registered view
engines (for example, in Global.asax) you should make sure that you
are referencing Microsoft.Web.Mvc.FixedRazorViewEngine or
Microsoft.Web.Mvc.FixedWebFormViewEngine, instead of the classes that
ship in the core runtime binary
Hopefully this question is not to confusing, but I can help clear it up and there is a definitive answer: Yes or No (and why of course). I develop a lot of internal intranet applications using ASP.NET Webforms targeted for the Windows Environment and IE. This allows things like Windows Authentication and the drag-and-drop ASP.NET server controls work extreamly well and the focus is typically on the function rather than the pazzaz or the look of the site; I'm not selling products here to the masses.
However some users are starting to use Macs, and as we know the default browser is Safari. Unfortunantly Safari does not support Windows Authentication. To add on, a lot of the out-of-the box ASP.NET server controls don't render properly as they do in IE. Plus I have to take into account all the differences I need in my .js as well.
Now looking at this from an internal busniess perspective, having a single enterprise platform is not uncommon, so assuming the users are on IE is not a problem. However as more Macs get introduced, bridging the gap to make these intranet web apps browser agnostic can be quite a difference in development time.
I was wondering if ASP.NET MVC has a leg up on this issue. I know it does not solve the Windows Authentican issue (chime in on this as well for solutions), but I was wondering since server controls were not being used like with web forms, if using MVC was the advantageous choice when trying to make web applications cross browser compatible? I don't mind doing MVC as opposed to webforms, and if there is documented or gained knowledge on why MVC works better for cross browser use, then speak to it. If experience shows the way that MVC renders its controls as opposed to server controls from webforms is better across different browsers, this is mainly what I am trying to detmine.
Does anyone know about this? Thanks!
ASP.NET MVC gives you more control about how HTML, CSS, and JavaScript is rendered because you don't have all of the built-in controls that render this for you. Since you have full control over these elements, you are more enabled for developing in a cross-browser manner. This puts more burden on developers. It's a classic power vs. responsibility trade off.
MVC does do away with the mangled html of server controls, the huge footprint of viewstate, and generally makes the rendered html much cleaner and more efficient. So to answer your question, Yes, MVC will make it easier for you to have clean html that stays just the way you wrote it, without having asp.net's rendering mangle everything.
Windows authentication is supported in Safari. If you are facing issues can you give some specifics.
The web form controls (with newer version of asp.net) usually work across browsers fine. The problem is when it doesn't, it is hard to track them down. I have also had issues where they didn't work well with IE6, tracking them and fixing them is little hard in Web Forms. But that is trade off if you want drag and drop controls.
With MVC, there is no concept of controls similar to web forms. You control everything that is delivered to the client, the HTML, CSS and Javascript files. You do have HTML helpers to render your models to corresponding HTML controls. The amount of extra code you will be writing will depend on the task you are trying to accomplish. Since you control all the assets delivered to the client it makes it easier to track bizarre one off browser specific issues.
Using MVC doesn't mean you won't run into cross browser issues, you will. It may be easier to fix but then if you are experienced in web forms you should be able to achieve the same results.
How to create web application using Qt?
This depends on what you mean by "web application". If you mean an application that can show parts of a web page in its interface as rendered HTML, like a browser can...yes. Qt incorporates something called QtWebKit:
http://doc.qt.io/qt-5/qtwebkit-index.html
(Note: Back in the olden days it was Microsoft--I think--who first made an embeddable Internet Explorer control so that you could fetch a URL into the midst of some MFC or VB application and run a browser in the midst of your otherwise-form-based application. The event hooks for Microsoft's solution sucked, Qt's are much better.)
Anyway, this is great if you want people to install your application on their machine, where it fetches web data but takes advantages of native features to be richer than a browser could. But be careful because these days native apps have to be really outstanding to surpass the advantage of something that runs in a browser they already have.
HOWEVER If you are trying to use QtCore to push server-side content out and fulfill web requests, that'll be an uphill battle. You might find some related examples if you look hard enough:
https://web.archive.org/web/20100922075100/http://labs.qt.nokia.com/2006/12/20/whats-this-cgi/
Very few people use C++ (much less Qt) to generate web pages server-side. Yet there are still some doing it, even in pretty cool ways:
http://www.webtoolkit.eu/wt
...regardless, QtCreator will be no help in that kind of pursuit.
The functionality you are asking for does not exist within Qt itself. However, there exists (at least) one third party library that allows some of the Qt code for a desktop app to be re-used to a certain extent for serving up a web app:
http://cutelyst.org/
However, this does not magically allow you to write a QML interface with QML Widgets and have a visual interface accessible via a web browser.
What do you mean by "web application"? Is it a desktop app with web features? If so, yes Qt in general is very good for that.
If you mean a kind of server that outputs HTML, then you should use something else because you would have to reinvent many wheels to make it work.
You'd require to run or embed web server. It would be more whise to turn to a Apache Web Server or Apache Tomcat based approach. Otherwhise you'd run somewhat against the odds.
Consider also using some HTTP server library like libonion or Wt. Wt is close in spirit to Qt. However, you won't use Qt itself. libonion is lower level (and you may want to use browser-side Web frameworks like e.g. JQuery or AngularJS with it).
If you already have some Web server, you could consider developing some FastCGI application in C++.
You surely need a good understanding of HTTP protocol and of HTML5 & AJAX.
Since this is 11 years old, I thought I'd come here to tell you that it does indeed seem possible now that qt supports webassembly. The newest version, 6.4 (newest version as of today jan 31 2023), now offers support for webassembly and their website has various examples of apps built with qt that run in the browser.
https://www.qt.io/qt-examples-for-webassembly
I am working on an ASP.Net application and I want users to be able to take a picture with their local webcam and then upload it to the server.
I can, of course, rely on users doing this manually via their locally installed software, save the image as a file and do a normal file upload. However, what I really want to do is incorporate it all into a UI in the browser.
I know this means accessing local resources so do I need an ActiveX control or Silverlight or is there something I could do in Javascript for example?
This is initially intended for an Intranet app so I can have control of the client's environemnt, including stipulating the browser etc, which means I can use an ActiveX control if I have to. However, it would be nice if I could write this in a generic way so it could be used in an internet app generally (happy to stipulate that it only works on Windows clients but would be good to get it to work in FireFox).
Thanks.
The only acceptable and universal way to this for now is Flash/Flex application. Flash player presets literally in every browser in the world and all of them has such capability.
VideoCap Pro is quite popular, and it offers an ActiveX version, have you checked it out?
This sounds very suspicious to me. You realize the nefarious applications this could be applied to, right? A web page that when a user browses to it, unknownst to them, their webcam snaps a pic of them. ... I don't like it.
You could use the Nimbb API to do the webcam video recording inside a browser.
It is possible to get the image from client webcam in asp.net, you have to install the Silverlight 4 with Visual Studio 2010:
Go to following link:
http://wildermuth.com/2009/11/23/Taking_a_WebCam_Photo_with_Silverlight
I have a problem where a Web Application needs to (after interaction from the user via Javascript)
1) open a Windows Forms Application
2) send a parameter to the app (e.g. an ID)
Correspondingly, the Windows Forms Application should be able to
1) send parameters back to the Web Application (updating the URL is ok)
2) open the Web App in a new brower, if it does not exist
If many browser windows are open it's important that the correct one is updated.
Windows Forms Application is in ASP.NET
Browser is IE6+
The applications are controlled and internal for a specific organisation so it's not a question of launching a custom app.
Question A) Is this possible?
Question B) How do I send parameters to an open Windows Forms Application from a Web App?
Question C) If updating the Web App, how do I make sure the right browser is targeted?
What you're asking for is possible but seems awkward.
Trying to call an application from a web page is not something you could do due to security considerations. You could however make a desktop application which would be associated with a certain type of files and then use content-type on the web page to make sure that your app is called when a URL with this type is opened. It would be similar to the way MS Office handles .doc or .xls documents or the Media Player opens the .mp3 or .wmv files.
The second part (opening a particular web page from your application) is easier.
As you should know the address of your web page create a URL string with the parameters you want and open it in default browser (there are plenty of examples on how to do that, a sample is below).
System.Diagnostics.Process.Start("http://example.com?key=value");
If you want to update the page in the already opened browser or use a browser of your choice (i.e. always IE6 instead of Opera or Chrome) then you'll have to do some homework but it's still quite easy.
PokeIn library connects you desktop application to your web application in real time/per user. Moreover, due to its reverse ajax state management, you could consider both of your applications as one.
Check out
http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
Using VBScript in your Web Page you can call an open Windows Forms application and send keys to it.
This only works on IE though and you need to adjust the security settings to allow ActiveX.
Have a look into "registered protocols" (for example here and here). I know Skype does this to make outward phone calls from a web page. But probably some changes will be needed in the win application to intercept the parameters from the url.
I haven't tried this but it should be possible
No I don't think it's possible.
Think of viruses/trojans/spyware. If it were possible to launch an application from a mere HTML page, it would be very easy to install malware.
Browsers are designed to prevent you from doing that.
You could use clickonce to deploy and start the forms app - this should take care of sending the parameter to the app.
While this may not perfectly fit with your application, what about using a web service and the form?
Also, you can pass parameters to ensure IE6, not Firefox opens.
System.Diagnostics.Process.Start("c:\ie6\ie6.exe http://www.example.com/mypage");
Ok, so I actually found a clue to the web -> winform part.
The following code was handed to me from an web application that sends a parameter to a winform app. I assume this solution has some security factors in play (such as allowing running VBScript (and ActiveX?) in the webpage. That's ok for me though.
The code:
<script type="text/vbscript" language="vbscript">
<!--
Function OpenWinformApp(chSocialSecurityNumber)
Dim oWinformAppWebStart
Set oWinformAppWebStart = CreateObject("WinformAppWebStart.CWinformAppWebStart")
oWinformAppWebStart.OpenPersonForm CStr(chSocialSecurityNumber)
End Function
-->
</script>