The issue I describe here affects only my development machine. Deploying to different servers (Test and Production) do not exhibit this behaviour.
I have a simple ASPX (ReportViswer.aspx) page that contains a DevExpress Report Viewer in it as follows:
<%# Page Title="" Language="C#" MasterPageFile="~/SiteV2.Master" AutoEventWireup="true" CodeBehind="ReportViewer.aspx.cs" Inherits="MyApp.Platform.Reports.ReportViewer" %>
<%# Register Assembly="DevExpress.XtraReports.v16.1.Web, Version=16.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraReports.Web" TagPrefix="dx" %>
<asp:Content ID="cntPageTabs" ContentPlaceHolderID="cphPageTabs" runat="server">
<ul class="nav nav-tabs">
<li class="active">
Page
</li>
</ul>
<div class="tab-content tab-content-for-page">
<div class="tab-pane active" id="tab-page">
<asp:Button ID="btnToolbarClose" runat="server" Text="Close" CssClass="btn btn-default" OnClick="btnToolbarClose_OnClick"/>
</div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphMainContent" runat="server">
<dx:ASPxDocumentViewer ID="ReportDocumentViewer" runat="server"></dx:ASPxDocumentViewer>
</asp:Content>
The page itself does nothing really clever other than instantiating an XtraReport and assigning it to the report viewer:
protected void Page_Load(object aSender, EventArgs aEventArgs)
{
if (!IsPostBack)
{
if (Session["ReportParams"] == null)
{
ShowErrorMessage("No report information was passed.");
return;
}
ReportParametersHelper reportParams = new ReportParametersHelper();
reportParams.Deserialize(Session["ReportParams"].ToString());
XtraReport reportToView = null;
switch (reportParams.ReportName)
{
case ReportNames.REPORT_DISCOVERY_DOCUMENT:
reportToView = new ReportDiscoveryDocument();
(reportToView as ReportEmailMessage).Activate(ReportParams.Params);
break;
}
}
}
The WebForms 4.6.1 solution is running against IIS 10 on Windows 10 on my development machine and when I try and open the above page via a simple Response.Redirect(~/reports/reportviewer) I either get prompted for a username and password:
or ultimately a resource not found error:
The application is running against the DefaultApp pool that is configured as:
So my questions are:
Why does this work on production and staging and not on my development machine (ie ReportViewer displays just fine with no issue)
Is there perhaps a correlation with the fact that IIS things this page is .NET 2.x? (see screenshot)
Any ideas on how to debug this? I cannot develop reports on this machine.
DevExpress has been unhelpful as they want a small sample project - and while I understand that the test harnesses do not exhibit this behaviour so it is something in this much larger project.
So any insights or ideas would be appreciated and I am happy to provide more diagnostics information as required.
This issue is likely caused by your development machine routing settings rather then by DevExpress components. If this is the case, you will be able to reproduce it even if you remove the ASPxDocumentViewer control from your WebForm.
Try passing the following route format to your Response.Redirect method "~/reports/reportviewer.aspx". This is the default ASP.NET WebForms route format, and when you are using the "~/reports/reportviewer" IIS attempts to open the folder rather then a web page, so the authorization is requested and 404 error is thrown. This issue is not reproducible on another machines because of different routing settings.
See the ASP.NET Routing MSDN article for more information on how routing works in ASP.NET.
Related
I am in the process of converting a Web Site Project To Web Application Project. The website project works perfectly with session variables in the .master file or .aspx file. During the conversion of web application all the session values used in .aspx/.master file throws an error "session does not found at the current context" Is there any workaround for using session variables on the master page.
In this scenario, when the user logs in the session values are set and depending on the session values the pages are redirected. I am checking the session values in the HTML body using <% C#code %>. It gives error on all the session variables used.
I am trying to follow the link below in this process
How to convert ASP.NET website to ASP.NET web application.
<ul class="SM">
<% if ((Convert.ToString(Session["ACCESS_LEVEL"])) == "ADMIN"))
{ %>
<br />
<li><a href="/FacultyDevSystem/Personal/FDS_AdminPersonalProfile.aspx?
fromwhere=LogAsAdmin" >Details</a></li>
<% }
else if ((Convert.ToString(Session["ACCESS_LEVEL"])) == "DDIR"))
{ %> <br />
<li><a href="/FacultyDevSystem/Personal/FDS_DDirPersonalProfile.aspx?
fromwhere=LogAsDDir"> Details</a>
</li>
<% } %>
I'm working on relatively outdated asp.net website (not web app) project.
I was asked to do some changes in the master page, which I did and it works fine when I run locally.
The error is happening when I want to build and publish the website, I'm getting error message that the name 'XXX' does not exist in the current context, although I'm able to access the control by their id in the code behind file.
This is what I have:
<div class="mainLogin">
<asp:TextBox ID="loginEntry" CssClass="login-name" placeholder="Username or email address" runat="server" ></asp:TextBox>
<asp:TextBox ID="passwordEntry2" CssClass="login-password" placeholder="Password" runat="server" TextMode="Password"></asp:TextBox>
<div class="login-remember-me">
<input type="checkbox" runat="server" id="chkRememberme2" />
<label>Remember me</label>
</div>
<button class="login-submit orange-button" runat="server" OnServerClick="btnLogin_OnServerClick" ID="btnLogin">Login <div class="arrow-right"></div></button>
</div>
It all works fine when I run that locally but when I try to build and publish this is the error I'm getting:
The event which is happening in the code file:
protected void btnLogin_OnServerClick(object sender, EventArgs e)
{
if (loginEntry.Text != string.Empty && passwordEntry2.Text != string.Empty)
{
logInProc(loginEntry.Text, passwordEntry2.Text, chkRememberme2.Checked);
}
}
And the master page directive:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="MasterPage" %>
Code file:
public partial class MasterPage : ParentMasterPage
{
//master page code here
}
If I remove those new controls and new functionality, I'm able to run the project without any issue.
Any idea what is wrong?
Try To Clean the solution then rebuilt it
if not work then go to deisgner.cs page then check that the entry for above text boxes are there or not? fix it there
i'm programming in asp.net with umbraco and have a problem with master page.
i made a master page then added a web user master page that link in my default page.
at run time project in umbraco when i click on link saw this error :
Page not found
No umbraco document matches the url
'http://localhost:20771/WebForm1.aspx'
umbraco tried this to match it using this xpath query'/root/*
[#urlName = "webform1"] | /root// [#urlName = "webform1"]')
This page can be replaced with a custom 404 page by adding the id of
the umbraco document to show as 404 page in the
/config/umbracoSettings.config file. Just add the id to the
'/settings/content/errors/error404' element.
For more information, visit information about custom 404 on the
umbraco website.
This page is intentionally left ugly ;-)
i search in web and did not find any solution about it.
Check that your master page shows up in the admin area via Settings > Templates.
Then, check that your content page (in the admin Content section) has a template defined (under "Generic properties"). If it doesn't, and it doesn't let you select a template, then you need to allow that template to be used for that particular node type.
Go to Settings > Document Types, select your node type, and under "Allowed templates", select the template that you wish to us for the page (you may select a nested masterpage, it should still work just fine) - also make sure that the "Default allowed template" underneath is selected to your chosen template. Once you have hit "Save", go back to your node in the Content section, go to the "Generic properties" tab, and select the template you wish.
Umbraco lets you use any number of masterpages for rendering a content node. When creating new nodes, you then choose the template you wish to use (or use the default, as specified by following the above instructions).
You can also force a different template to be used at runtime, using the ?altTemplate=MyTemplateName querystring option on your page URL - handy for mobile sites, RSS views, and suchlike.
In Master.master page (it's general master page.) you can locate asp:ContentPlaceHolder
please attention to this code.Perhaps it's help you.
<div style="vertical-align: top;">
<umbraco:Macro ID="Macro1" Alias="NavigationControl" runat="server"></umbraco:Macro>
</div>
***<div>
<asp:ContentPlaceHolder ID="DefaultPageContent" runat="server">
</asp:ContentPlaceHolder>
</div>***
<div>
<asp:ContentPlaceHolder ID="TextPageContent" runat="server">
<!-- Insert default "ContactUsContent" markup here -->
</asp:ContentPlaceHolder>
</div>
<div>
<asp:ContentPlaceHolder ID="AtAGlanceContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="footer">
<uc6:FooterControl ID="FooterControl1" runat="server" />
</div>
</div>
</form>
my question is the following
I need to change a menu in this page, but how do I recognize how this page was written.
Normally, I do stuff in php, but this is new to me.
I can see the words asp and c#, but it is not developed as a "dot net thing", is it?
..otherwise I would need visual studio, I guess?
the homepage code
<%# page language="C#" autoeventwireup="true" inherits="_Default, App_Web_npdtwtc3" masterpagefile="~/Site.Master" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.slideshow').cycle({
fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
});
});
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p align="left">
<br />
<br />
<br />
<br />
<font size="9">Multi Mind</font> <br /><br />
<IMG SRC="images/contactgegevens3.png" ALT="" ALIGN=RIGHT><br />
Tax Recruitment is de specialist op het gebied van arbeidsbemiddeling voor fiscalisten.<br />
Het richt zich
thanks, Richard
It appears to be a ASP.NET Web Forms page (ie. .aspx).
So mostly mark up, either run on the server (elements with runat="server") or client (other HTML elements) but there is some JavaScript using JQuery.
For an introduction to ASP.NET Web Forms try here (this is .NET v4, but has links to the pages for earlier versions): http://msdn.microsoft.com/en-gb/library/ms178125.aspx
It's an ASP.NET Web Site or Application (someone help explain the difference in this context) and that particular file is an ASP.NET Web Form. There's generally no need for Visual Web Developer, you could use any text editor really - but it sure makes it easier.
Note that your example uses master pages so you're only looking at the unique content for that particular page - the menu you're after is likely the same across different pages (?) and hence specified in a master file (the name and path to it is defined on the first line). Perhaps looking at that file would make things clearer.
This is ASP.NET with C# as the code-behind. Also a little bit of javascript in there. You will most likely need Visual Studio to edit this easily. You can get visual studio express for free from here:
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express
Good luck with your work.
As stuartmclark mentioned, this is an ASP.net page with C# as code behind language. To explain this,
language="C#" tells you that the code behind is C#. If you are now aware of code behind concept, you can think of this as server side script.
asp: anything starting with asp: are the ASP.net controls. This tells that this is an asp.net page.
And yes, to work on this you need either Visual Studio or Visual Web Developer. You can downlaod Visual Web Developer from here. It's free (as in free beer) from MicroSoft.
Hope this will clarify your doubt.
I need to make a quick demo showing how to do interactivity on an ASP.NET MVC page.
I opened an ASP.NET MVC project in Visual Studio 2010, put the view in design mode, dragged in a button, double-clicked on it and looked at the view again. I was expecting to see some ingenious JQuery code generated but instead an <asp:Button> and a <script runat="server"> block was created, which seems to be a mixing of classic ASP.NET and ASP.NET MVC metaphors. I don't think that is the recommended way to build interactivity in MVC, right?
So what is the easiest, most standard-MVC approach for me to (1) create a button, (2) when the button is clicked, change some text in my view?
is it really best practice in MVC to use the runat-server block?
are there some easy wizards which generate JQuery interactivity so that I can do this in a best-practice MVC way?
or do I need to implement the JQuery myself as I would on a plain HTML page without ASP.NET MVC?
View:
<%# Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Home Page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<h2><%: ViewData["Message"] %></h2>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</p>
</form>
</asp:Content>
You should not use asp.net ajax controls in asp.net MVC.
If you want to create a button just write some old-fashioned html like:
<input type="button">Button</input>
then if you need this button to make some action, just write new action instead of code behind method like and call it like:
<input type="button" onclick="javascript:window.location = 'http://mypage.com/mycontroller/buttonaction' />
or even better create a link instead of button by using mvc builded-in html helpers:
<%= Html.ActionLink("Do something" ,"ButtonAction") %>
Faster you catch it better for you. You need to resign from asp.net ajax habit. There is no postback or code behind and it's removed with a reason. MVC is controlled by executed actions which means that you are steering the application by calling specified links. By using pure html you've got lot more control on your output code and flow of actions in your application.
Remember that MVC is not a new ASP.NET AJAX and those two will goes together, so if this style of writing we apps does not suits you then you do not need to use it. It's just the metter of choice which technology is better for you and your projects.
Also to learn more about mvc visit asp.net mvc webpage. I specially recomend you to see some videos like this one. It will definitely help you to better understand what mvc is and what are it's advantages and disadvantages.