Including an asp vb page in an aspx c# page - c#

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.

Related

using html source instead of actual aspx page

Somehow i have lost my source code but i have published project in precompile state on my hosted server. i am able to recover c# code using decompilers but unable to find the aspx pages code as they are in compiled form. when i view them in decompiler they just show me the C# code of aspx page which is not helping me.
Initially i decided to reconstruct them on the basis of GUI but its taking too much time. My questions is , is this possible i can use the html source of page instead of its actual aspx code ? i have the c# code for my page but no aspx code so if its possible just to copy the html in aspx file and try to run if this works?

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

Execute C# code while using .load jquery

Again, I've looked around to try to find some posts on this and there are many but none that address my specific question (that I could find).
What I am looking : I have a projects and it loads different pages (.aspx) in an iframe dynamically. Now I am trying to remove iframe and add a div and load aspx pages inside that div, using this :
$("#containerDiv").load("test/default.aspx", function () {
});
it loads aspx page easily but I am unable to execute C# code which is written in default.aspx.cs may be its not a good practice but I want to know is there any solution of my problem.
$.load will not your c# code why because it load only the contents of your aspx page not of aspx.cs.
Use user controls instead.
If need help how to implement user control refer this link.

How to refresh just a specific portion of an HTML page?

I have one HTML file containing several <div> elements. I want to refresh just part of the page using either JavaScript or C#. Can someone help?
I am trying to do it this way:
document.location.reload(document.getElementById("contentdiv"));
It reloads the whole page. I wish to reload contentdiv. If contentdiv is at the middle of the page then it should load only that part.
Thank you.
You could move the contents of everything you want reloaded into an external file, and either use the <iframe> tag and only refresh that frame, or you could use JavaScript and refresh the div with Ajax.
Ajax isn't that simple to explain in a short answer, but you can find plenty of information on it here: http://www.w3schools.com/Ajax/ajax_example.asp or if you use a framework like jQuery ajax is much easier.
iFrames can be implemented (on mypage.html, for example) like so: <iframe src='mypagecontent.html'></iframe> and in mypagecontent.html you could use <script type='text/javascript'>window.location.reload();</script> to refresh the frame.
Not sure if this is what you're looking for, but hope it helps somewhat.
What ASP.NET Framework are you using? If you are using Web Forms, look into UpdatePanel

Opening web page within existing web page

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>

Categories