Web site architectural mix HTML and ASPX - asp.net

I have already a web site written in Html but I want to add some dynamic contents in Asp.net. So I will add 2 or 3 aspx pages whit form to my project.So the question is: Is it necessary to convert my simple static HTML page to aspx to publish my web site? What is the best way in this case?

There is no need to convert your HTML pages.
Static and dynamic content can live side by side without an issue.
Just add your ASPX pages - you may need to consider a migration path if you do have a static page that needs to be converted to a dynamic one (a permanent redirect should do).

no, just go for the conversion to asp.net of those web pages which have the dynamic content.

ASPX and plain HTML pages can live together happily because from a browser's point of view they all are html pages.
Web browsers don't understand ASP.NET. The content they understand is HTML. So when a browser requests for an .aspx link all that ASP.NET returns is plain HTML (with CSS and javascript, which browsers also understand). So at design time when you add an ASP.NET control, lets say a DropDownList, ASP.NET will render it as a <select> HTML tag.

Related

How to include asp.net user control in .htm pages

I am creating one website where all pages are creating in html but dynamic pages are creating in asp.net. I have one problem in my all static html pages i want to display one user control in one form but pages are .html thats why pages do not support asp.net control. How can i do pls let me khnow if anybody know.
I don't think this is possible, unless you use an iframe which contains an asp.net page containing the user control.
Furthermore, if it is possible, I don't think this approach should be used. It would make more sense to convert the .htm files to .aspx files, and use rewriting to display them as .htm if this is needed.
You simply can't. Html pages don't get processed by your ASP.NET engine. You could change them into .aspx files, and include the control, preferably within the form-tag of the asp.net page.

How to display a HTML page in an ASP.NET Site.Master page

Please forgive the question if it is an obvious one, but I am new to web development and it has me stumped.
I have a website that has been developed using ASP.NET and it has a Site.master page which all of my other asp pages are displayed in. I have downloaded a copy of VisualLightBox which generates an HTML page to display an image gallery.
So what I need to know is:
How do I get the HTML page to display in the MainContent part of the Site.Master, or
How to change the HTML to be part of an ASP.NET page
If there are other threads that give me the answer could you point me in that direction.
A Site.Master page defines ContentPlacholders so that pages which inherit from the Site.Master can easily place their content in a unified layout. There is a good discussion of using a Site.Master in the ASP.NET quick start tutorials.
That said, you have several options for utilizing your HTML page along with your Site.Master. Much of the HTML rendered by VisualLightBox is boilerplate in that you do not have to use it. You simply need to extract the sections of HTML, JavaScript, and CSS that are important and restructure those in an .ascx or .aspx page. You can then use your Site.Master to link to the .aspx page or place the .ascx user control on the Site.Master.
I would suggest you just create an .aspx page with your HTML?

Padarn Master Pages (or how do I include .aspx pages)

Does Padarn support the concept of .NET Master Pages and/or the concept of Classic ASP #include?
I would like to reuse my .aspx pages in other .aspx pages as well as implement a single Header & Footer for the web site.
It appears as though Padarn doesn't support .aspx page reuse explicitly and that, maybe, I will need to dynamically generate/call Document objects within a Padarn Page to simulate the Master Page effect.
Before I try to get clever with simulating .aspx reuse within the Padarn framework, I would like to know if there is built-in support for this and/or if there is a best practice for this.
Padarn doesn't have built-in support for master pages or classic ASP syntax. For page element re-use (headers, footers, menus, etc) we typically use a base class in the code behind where we have methods that can render these elements. We then derive pages from the base to get the common functionality.

Best way to programmatically parse and transform ASP.NET Webform pages?

I need to programmatically parse and transform ASP.NET webform pages. It's a requirement that I have =(.
Anyone know any tools or frameworks?
Update:
I just need to modify ASPX pages (not rendered HTML code).
There are no inline c# code.
If you are parsing the resulting pages of an ASP.Net webform, meaning just HTML, then I'd go for Html Agility Pack and using XSLT for the transformation.
If you need to parse the actual .aspx server side code before it's rendered, then please include more information about what you need to do.

Is there a way to extend a class ASP session whenever an ASP .NET Request is made?

I have a web site that runs both classic ASP and ASP.NET Webforms. The sessions for each are separate.
I need to hit some asp page whenever a request is made on the ASP.NET pages.
Why? Because I need to extend the ASP's session so it doesn't expire.
I know this is going to cause a number of issues and I really really don't want to do this, but the decision is not in my hands, unfortunately.
Is there any way to accomplish what I'm trying to do?
Put a .asp page inside an iframe on the asp.net page? Just clarifying here... You don't need to make the iframe visible. 0px or whatever you want. But load it in the src= attribute.
Have a link to a do nothing ASP script file in the ASPX page? Or look at something like this.
Update- as you say you don't have master pages or anything like that. You could use an HttpModule to inject the extra HTML required to make the request to the classic ASP page. See here for an article on how to do that, or look at the code for this one. Creating one for your needs wouldn't be difficult. Find where you want to insert it and inject the extra HTML.
This might be a half cocked idea, but maybe on certain pages do a redirect to an asp page, then that page just redirects back to the calling asp.net page, I mean it all depends on what pages do what, but you can see where I am headed with this
Add a img tag to the page that targets one of the asp-pages in the application. Add a CSS class to the image that hides it and put something random or the current date in the query string so that it doesn't get cached, just to be on the safe side.

Resources