Opening web page within existing web page - c#

I need to be able to load web pages from different sites within a page on my site. I am using C# .NET and master pages. Within the content page, I want to be able to load an arbitrary page and display it without any of the browser controls appearing - just the page content.

Can you not just use a boring old iframe?
<iframe src="http://stackoverflow.com" width="900" height="500"></iframe>

Related

C# Get HTML generated by Javascript in a .Net Console Application

I have to write a Console Application that grap and parse data from a website.
Unluckly, the website uses some kind of Javascript framework to compose the page.
So what I need to do is get the HTML once time the page is rendered by Javascript.
This is just the first step, my second step is to navigate the website to collect data from different page but... Unluckly the pages that I have to parse does not have Urls, but they are loaded from Javascript too...
Do you have some ideas ?
Thanks to support
Dario

Getting content from web page, that is populated through a javascript

I'm trying to parse a web page using Html Agility Pack, what I have understod from my attempts is that the web page is "populated" using a javascript. When I load the page using
HtmlDocument doc = web.Load(linkToPage);
I get an empty page. The page is a sub page so to say, and I'm using the original page to scrap the links to these sub pages (it works for the main page since this one does not used javascript to populate the page, I assume).
Is there a way to parse a web page that populates through javascript, or is there a better tool for this?
See this if you wish to use JAVA, I worked with FTL and also JSrender, both were pretty cool

Add a new aspx page to a published website

I have a .Net website which is published. Now I need to add a new page to the website but I do not have the source code which means that I cannot recompile and republish the website. I know that I can add an HTML page for this as the content for the new page is just plain HTML but that would show .html extension in the browser which I don't want. Is there any way to add an aspx page or html page is the only option I have ?
Yes you can add pages without recompiling, just ensure the pages don't reference a code-behind file. You'll still be able to use code in the actual page itself, as well as reference controls (.ascx files).
alternatively, you can add a create an application and then add it as an application under the original website. As in, in IIS, right click on the original site, then Add Application; and put your new application into it. Your new application will have it's own application pools and is an application by its own right without needing the original site's data.

ASP.net, VS 2010, C# -- how to find a control on a different page?

I have a FormView on Default.aspx page. I have BLL_Census.cs class in App_Code folder. I want to set properties of textbox on FormView on Default page from BLL_Census.cs but don't know how to reference of find the FormView on the other page from within BLL_Census.cs.
It will be easier if you place the value from BLL_census.cs into session variable and access it when other page is rendered in the browser
A page only "exists" when the browser call it
So It's not possible to access another page from the current page.
If you need to share page area, use Page Controls
If you need to share data, use the Asp.NET Session
are you using website project? try web application project

Including an asp vb page in an aspx c# page

Can I have an aspx page written with a C# code behind file. And include an asp page with code written in vb?
Yes, you can have an ASP.NET C# page with VB.NET codebehind. You cannot have classic ASP VBScript page included using <!--# include -->.
No. You've got two options:
1) Code the aspx page in C# and drop an iframe on the aspx page. Use that iframe to load the asp page completely separately from the aspx page.
2) Make the asp page return only the markup you need on your aspx page rather than a whole page. You can then put an empty div on your aspx page and use AJAX to request the asp content and render it on the aspx page.
Both options have specific drawbacks. The first results in a page that isn't easily crawled and indexed by search engines. With the second, your asp page isn't going to easily be able to process any post back data.
It's possible to include asp code inside your aspx file. But you could use an iframe pointing to an asp file and have it called from your aspx file.

Categories