Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I embedded a aspx page inside a razor cshtml file

Posted on 2014-11-29
5
Medium Priority
?
609 Views
Last Modified: 2015-01-13
Hi,

I built a Responsive Design webpage with navigation menus with Bootstrap and MVC5.   I built it using Razor.    I have legacy aspx pages that uses a site.master file.   Is there a way to embed the aspx page inside my Webpage.   For example, I want the aspx page to show next to my navigation bar on the left side.   I currently redirect the View to the aspx page but it won't keep the navigation menus.   I hope this makes sense.   Thanks.

David
0
Comment
Question by:davidst98
  • 3
5 Comments
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 40471752
Depending on the type of output the page produces, you could use a server side include http://support.microsoft.com/kb/306575 or use ajax to inject the output to where you need.

If you don't need to pass a variable, then you can use an include file.  If you do need to pass a variable to the other page, than you will want to use ajax.

The only other option I can think of is not really a good option and that is to use an iframe.  The first two choices are the way I would go.

I am not a .NET developer and can minimally help on the specifics of these options.
0
 

Author Comment

by:davidst98
ID: 40471938
Thanks for the reply.   I tried the example and used Response.WriteFile but it just wrote the raw aspx file to the webpage and did not decode it.

David
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40471949
On that link I provided, if you look at the trouble shooting, it must be meant only for static html.  I use that all the time in classic asp.   It seems to not be the same in .net.  If that is the case, then an ajax call to that page is going to be the way to go.  
Server-side code in the dynamically included file is displayed on the client browser.

The dynamically included file may contain any client-side code, including HTML and JavaScript. If that file contains any server-side code, the server-side code is sent to the client browser as plain text and is visible if you view the source of the page that is displayed in the browser. Note that ASP.NET does not process server-side script in the dynamically included file. This is because all of the ASP.NET code has already run before it includes the file; thus, the server does not return to read anything for server-side processing again.
If you use Response.Write or Response.WriteFile statements in a code-behind module, these statements write the information before any HTML tags. The same behavior occurs if you use inline <SCRIPT> tags with the RUNAT="Server" attribute. 

Because the code-behind modules are compiled first, all of the output that is generated by Response.Write, Response.WriteFile, or inline server-side <SCRIPT> tags appears before any HTML tags when the HTML output is sent to the browser. This problem does not occur when you use Response.Write statements in classic ASP-style tags

Open in new window

0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40471950
I would also wait here to see if somebody who develops in .net has another option for you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question