Solved

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

Posted on 2014-11-29
5
427 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 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 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 52

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 52

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a starter for ETL protocol? 4 55
encoding an href string 2 20
mail.To.Add 5 26
RLDC Reporting in Visual studio 11 15
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 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