Iframe loading the base page after blazor publish - c#

I have a razor page in my application, accessed once I logged myself in the application via another razor page being the root of the application :
#page "test"
<div >
<h3>This is a test</h3>
<iframe src="./test.html" frameborder="0" id="test"></iframe>
</div>
The html file being just :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h3>test </h3>
</body>
</html>```
It correctly displays the test.html when I launch my blazor application in debug or release mode in visual studio.
But once I launch it after I published it, the iframe display the base page of the application, it's like the application inside the application, no idea why it is happening and the test.html is not displayed at all.
So basically the login page is displayed inside the iframe...
Any ideas how it is happening?

Related

Setting .NET Website on IIS Server in Windows Server 2016 Environment

ImageI am setting up my web application (working) in the Windows Server 2016 Environment which has the IIS role set up. My application outputs the following error when I try to run it: "The page you are requesting cannot be served because of the extension configuration" error.
I have a simple application that has a label and needs to change the text of label on Page Load. My .aspx files work if I don't mention the CodeBehind file .aspx.cs file .
I believe this is a case of .aspx.cs file access. I have a much bigger application and I made this small one for asking this question. My guess is that I cannot access my .aspx.cs file.
I have tried adding "allow fileExtensions=".cs" ....." and this add cs to the list of allowed files. I have also tried using the aspnet_regiis -i to install asp.net which worked correctly.
As for my setup, I have added the IIS role, installed the ASP.NET 4.5 and its Extensible feature and also ASP.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Intro.aspx.cs" Inherits="Intro" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<asp:Label . ...../>
</body>
</html>
UPDATE :Thank you all for your responses. This stackoverflow community is great . As for the solution I enabled .NET 3.5 features , .net 4.5 features, and all features related to a Web Server . A more concrete answer would help but this worked for me. Thank you all .
Web.config

IIS 10, VS 2015:Page rendering fine when run locally but loses styling on publish

This is the code in the default _Layout.cshtml that is added on creation of the project. This is shared by other views.
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>#ViewBag.Title - My ASP.NET Application</title>
#Styles.Render("~/Content/Site.css")
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/Mvc/Scripts/modernizr-2.6.2.js"></script>
</head>
All other views are rendered properly when run locally, i.e. they all get the same basic styling when run from the visual studio. But the pages loose styling after I published it using IIS 10.0, yet give me the desired look when run locally. I am using Firefox and Chrome, and not Edge.
How do i solve this?
Please check your styles and font folder in visual studio and in publish folder. Something might be missing.

Css is not loading in MVC4 razor layout

I have added the CSS in the _Layout but it is not loading the CSS or any Javascript Files
I have folder structure like this
Assets/Css/admin/... so on
In my MVC4 razor layout I am loading the css like this rather using Bundles
<link rel="stylesheet" href="#Url.Content("~/Assets/css/admin/module.admin.stylesheet-complete.min.css")" />
but its not loading the css according to this pattern. I used the same in MVC3 razor layout and it worked.
After loading clicking the url generated in rendered form in browser it shows
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS 8.0 Detailed Error - 500.0 - Internal Server Error</title>
Contents of my Css File
#import '../../../Assets/components/common/forms/editors/wysihtml5/Assets/lib/css/bootstrap-wysihtml5-0.0.2.css';
What seems to be the problem with MVC4 ?
Please guide
Thanx all I have figured it out. I have changed the project setting to Annonymous Authentication to Enabled and Windows Authentication to Disabled. The problem is solved by doing this. Thank you for your efforts

.aspx code errors "Element 'xxxx' is not supported."

I'm getting a bunch of these errors for my image buttons, link buttons, text boxes, and labels. These errors are in my .aspx code. Why am I getting so many?
<%# Page Language="C#" AutoEventWireup="true" CodeFile="frmSearchPersonnel.aspx.cs" Inherits="frmSearchPersonnel" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div align="center">
</div>
</div>
<asp:Label ID="Label1" runat="server" Text="Search for employee by last name"></asp:Label>
<asp:TextBox ID="txtSearchName" runat="server"></asp:TextBox>
<p>
<asp:Button ID="btnSearch" runat="server" PostBackUrl="~/frmViewPersonnel.aspx"
Text="Search" onclick="btnSearch_Click" />
</p>
</form>
</body>
</html>.
The errors are under Label, TextBox & Button above in blue. The errors state:
Validation (): Element 'xxxx' is not supported.
The only problem I & my Resharper see is the period after the ending html tag.
</html>.
What are the errors you are getting?
Edit:
Here's a simple fix someone had:
http://weblogs.asp.net/alaaalnajjar/archive/2010/08/31/how-to-fix-quot-validation-element-xxxx-is-not-supported-quot-visual-studio-2010.aspx
the idea is to remove the folder "ReflectedSchemas" from paths:
Win XP : C:\Documents and Settings{username}\Application
Data\Microsoft\VisualStudio\10.0\ReflectedSchemas
Win Vista / 7: C:\Users\AppData\Roaming
\Microsoft\VisualStudio\10.0\ReflectedSchemas
Note: make sure that "Show hidden files, folders, and drives" is
selected from Folder Options,also don't forget to close VS before
deleting the folder.
This solution should work for VS2010 and VS2008,at VS2008 you have to
delete ReflectedSchemas from folder 9.0 not 10.0.
This issue has been reported before. I found an article with steps to resolve:
Close down Visual Studio 2008 (or Visual Studio 2010).
Go to Control Panel -> Appearances and Personalization -> Folder Options -> then select the View tab. Now make sure "Show hidden
files, folders, and drives" is selected and click OK.
Now browse to the following folder: Computer -> OS (C:) -> Users -> {username} -> AppData -> Roaming -> Microsoft -> VisualStudio -> 9.0 folder. Note: in Visual Studio 2010 would be 10.0 folder.
Now delete the "ReflectedSchemes" folder. This should fix "Validation (): Element '' is not supported" error for ASP.NET server
controls within Visual Studio 2008.
After reopening your Visual Studio 2008 project, you should now have intellisense working correctly for ASP.NET server controls.
See here for more details:
http://www.gotknowhow.com/articles/fix-validation-element-not-supported-visual-studio-2010
add this in your page.
<!DOCTYPE html>
<html lang="en">
istead of
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
In hopes of helping someone else from a google search like mine:
Visual Studio 2013 - I did the same as suggested by the others deleting the "ReflectedSchemes" folders to no avail.
Finally, I deleted <html xmlns="http://www.w3.org/1999/xhtml"> - then replaced it and the problem suddenly went away. Come to think of it, seems like I've done this before too.
FWIW....
Noticed I had to delete the contents of ReflectedSchemas in:
%AppData%\Roaming\Microsoft\VisualStudio\9.0\ReflectedSchemas\
and
%AppData%\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas\
also followed the reset VS2010 settings:
https://msdn.microsoft.com/en-us/library/ms247075(v=VS.100).aspx
to get it to clear the problem.
For those that deleting of "ReflectedSchemas" folder has not worked - do following
Close Visual Studio
Try again to delete (Windows 7 paths):
C:\Users\DefaultAppPool\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas
C:\Users\Classic .NET AppPool\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas
C:\Users\Classic .NET AppPool\AppData\Local\Microsoft\VisualStudio\ReflectedSchemas
C:\Users\[your_nt_name]\AppData\Local\Microsoft\VisualStudio\ReflectedSchemas
C:\Users\[your_nt_name]\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas
For me above has not worked, so I simply copied whole folder
Users[your_nt_name]\AppData\Roaming\Microsoft\VisualStudio
from another machine where these problems did not occur. After this all ASP.net IntelliSence problems were gone.
I'm keeping compressed backup of VistualStudio folder in case this happens again.
Change the target validation to "HTML 5" and click OK, Element is an HTML 5 supported validation so it can not supported in XHTML1.0
Refer Below Screenshot Set Vadation to HTML5

Regarding Telerik Reporting

I created this class library(ReportLib) with a simple Telerik report using Telerik Reporting Wizard. I then made this simple web application project, added ReportLib as a reference. Now in my asp page, intellisense is not detecting Telerik:ReportViewer tag! In the code behind too I have added the following ;-
using Telerik.Reporting;
using Telerik.ReportViewer;
What's wrong ? My web app project is building successfully. Why won't it detect the telerik tags?
[EDIT]
Do i need to register the Telerik.Reporting.dll on my aspx page too? How to do that ?
Registered assembly as follows..still wont detect the telerik:report viewer tag:-
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplicationReporting1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%# Register Assembly="Telerik.Reporting" Namespace="Telerik.Reporting" TagPrefix="telerik" %>
<%# Register Assembly="Telerik.ReportViewer" Namespace="Telerik.ReportViewer" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<tel
</div>
</form>
</body>
</html>
[EDIT]
ok in my web config file..there's no telerik assebly added that I can see..How so ? I did add the refernce to telerik reporting dll! Why didnt it show up in web config file?
Check the Telerik Reporting documentation about your problem. First, you will need to create your report within a class library project, and then assign the report to the Web Report Viewer.
In case you still have problems, contact Telerik - they will assist you with a more detailed reply.
Your project most likely, does not have the correct reference to the correct Telerik assmbly. The contractors we sometimes hire where I work, run into this and 100% of the time thats been the issue.
If you dont know how to register the control then go into the design mode for your page and drag it from the toolbar, and drop it into your page. VS will write the code for you.
The drag-and-drop solution will also take care of your web.config settings

Categories