Solved

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

Posted on 2014-11-29
5
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 53

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 53

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 53

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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

630 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