Webview2 Iframes handling issues in C# - iframe

In our windows forms application we are migrating the webBrowser to webview2 control.
we are loading the client web site which is having iframes completely and we have zero control on the client web site.
seeing the webview2 git hub there are many open issues.
Is webview2 control matured enough to handle the iframes?
I could not get any sample code from microsoft documentation and stack overflow to handle Iframes.
How to use webview2 control to handle the iframes in windows applications using c#?
I could see corewebview2_framecreated event but could not get sample code for the same.
Any sample code or Url to handle iframes is higly appriciated..
Tried to use corewebview2_framecreated event but this event is not firing
The below simple code is also returning nothing.
Not sure why I am unable to get the values for iframe using the below code or corewebview2_framecreated event.

Related

Issue while using WinForm user Control in asp.net MVC applicaton

I need to use a WinForm User Control in an ASP.Net MVC4 application.
The control has been embedded using the object tag and classid attribute, but upon viewing the view in browser, only a blank frame is visible, without any cross-sign on top-left corner of frame. The viewing browser is on a machine with .Net Framework 4.5. Similar issue was faced in an ASP.Net application but same was rectified using Registry setting (EnableIEHosting = 1).
Kindly suggest.
Thanks.
Gitika
WinForms user controls are not intended to be used from an ASP.NET (MVC or not) application.
As you should already knows, ASP.NET generate HTML codes that will be sent to the browser when requested. The browser can run on a multitude of operating systems (OS). WinForms user controls essentially only run Under Microsoft Windows.
The second thing to know is that a browser run in a restricted environment and as such as a very limited access to the computer and its OS.
Since you are using ASP.NET MVC, then you should create a partial view that is similar to your user control if this is what you want. Also, another thing to know is that any logic behing your control need to be converted to JavaScript or jQuery. This is what browsers understand.

XMLHTTPREQUEST or AJAX Update panel?

whenever I've used Ajax, I've used asp.net Ajax update panel and script manager provided in visual studio (and Ajax extensions if I needed them), but just recently I bought this (Pro Ajax and .Net 2.0 Platform and in this book the whole focus of Ajax has been XMLHTTPREQUEST, and there is no discussion of script manager, update panel or what so ever.
So, I wanted to know, is there any difference between these two or is this visual studio's update manager is just a wrapper around XMLHTTPREQUEST? Also, which one is better performance wise, or are they just the same? And finally, which one should I use?
Script Manager, Update Panel are Microsoft implementation of the AJAX framework. Internally it use XmlHttpRequest to make out-of-bound request.
Check out the below list of AJAX framework from wiki.
http://en.wikipedia.org/wiki/List_of_Ajax_frameworks
Microsoft AJAX implementation is type of full framework which provide rich programming model including server side controls, services and client side scripts. Eg. Update Panel server control lets you execute server-side code and return updated markup to the client browser with out-of-bound request.
But as for performance wise, it would be slower than service base/ajax because although out-of-bound request, UpdatePanel is really a post back to the server which will go through the full page life cycle.

ASP.NET MVC - Quickest way to preview changes to page in MVC app using VS web server

I'm an ASP.NET Web Forms developer who has recently switched over to an MVC web app.
I'm having difficulty working out the quickest way to preview code changes when running the MVC web app through the integrated Visual Studio web browser.
In web forms, I can make a change to the codebehind and simply refresh the page and it's all good.
In MVC, I seem to have to close the tab in the browser, return to Visual Studio and press F5, wait for it to build every single dependent project and open up a new tab in the browser to display the page. This is so much slower than how it works in Web Forms it's driving me to distraction.
Am I doing things right? Is there a way to speed this cycle up?
The view pages themselves are compiled dynamically and thus any changes to these can be viewed simply by saving the changes and refreshing the pages in the browser. Changes to code made elsewhere, however, will require a rebuilt after which you can refresh the page.
Pressing F5 will start the web server (if it isn't already started) and then attach a debugger to the process after which it will fire up the web page. The first two steps are very slow, and you should avoid them unless you specifically need to start the web server or debug the application.
So
Changes to view: ctrl+s -> refresh web page (f5)
Changes to code: ctrl+shift+b -> refresh web page (f5)
I used to find setting my project to run via IIS, rather than Cassini, made it a bit quicker. If you've made changes to the code, you'll still have to compile the solution, but at least this way you aren't waiting for Visual Studio to slowly crank itself into gear every time.
Found this article that might provide some clues too:
What are the (dis)advantages of using Cassini instead of IIS?

ASP.Net Controls in Delphi

I'm sure this question has been asked already but I couldn't find any posts.
Is it possible to use an ASP.net control in Delphi 2006 for Win32? We have some Dev Express ASP.Net visual controls (Chart controls to be exact) that we would like to use in our Delphi application.
Is this possible and how could it be done, preferably without the need to purchase more third party components.
Thank you.
you cannot use this kind of controls directly in a Delphi Win32 Application, because this components are designed to run in a web server with ASP and expose the results to a browser client, i think which your best option is use a local (or remote) web server and make a web page which accepts HTTP requests, and then in TWebBrowser in your Delphi Win32 app load the page to get results.
That is not going to be possible as the DevExpress ASP.NET controls are wired up via handlers in the web.config and not something that can be forced into Delphi. I assume you have looked at DevExpress's VCL controls for (Delphi and C++ Builder Controls) on it's website? If the VCL product suite does not have what you need then you will need to look elsewhere.

Compile errors after converting to a Web Application Project from a Web Site

I'm trying to convert a Web Site to the Web Application project model and I'm running into compile errors that do not seem to be covered by the guidance I found at Converting a Web Site Project to a Web Application Project.
The issue is that standard ASP.NET controls that are embedded as child controls within the ContentTemplate of the Ajax Control Toolkit's TabContainer/TabPanel are no longer visible to the page (and result in compile errors). It appears that they can only be referenced with a call to FindControl whereas, when the project was a Web Site, they were directly accessible in the page's code behind file as properties.
Unfortunately, we have a lot of webforms that utilize the TabContainer, and converting all the references to child controls from simple property refences to FindControl calls will be quite burdensome.
While researching the problem I found a reference to a property called TemplateInstance in Single Instance Templates that seemed promising, but I understand that this is applicable to control designers, not control users. Any help would be much appreciated.
I thought I'd add one other point. The problem is not specific to the Ajax Control Toolkit's TabContainer. Indeed, I have a FormView control, and all the child controls in the ItemTemplate are no longer recognized by the compiler as being properies of the Page and result in compile errors. I can't believe that I have to change all of these propery references to findcontrol calls throughout my forms just because I moved from a Web Site to a Web Application Project. :-(
I'd be curious to hear what your final decision was to resolve this.
Reading your post, compared with my own current web app conversion research, leads me to venture out and refer you to this page hoping it may shed some light on what happens with your code-behind file upon conversion and compilation.
Did you generate a designer file for all the controls, via "Convert to Web Application..."

Resources