I have a question about IIS and ASP.Net.
I migrated to a new server, in wich I have to run an Upload/Download Application. This application was running good in an old server, now I´m getting some parsing error, that I don´t get it where it comes.
It works when I try to donwload some files, also I have a connection and the login system works.But if I try to upload some files, then come this parsing error. At the beginning I was thinking it have to be some permissions issues, but after I added some user privileges it doesn´t make some sense.
XML Parsing Error:
no element found Location: http://www.mywebsite.com/DownloadManager/DMUpload.aspx?folderId=22767&guid=271334658&cancel=1 Line Number 1, Column 1:
And this is my upload.aspx file:
<%# Page language="c#" Codebehind="DMUpload.aspx.cs" AutoEventWireup="false" Inherits="DownloadManager.DMUpload" EnableSessionState="ReadOnly"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>DMUpload</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="StyleSheet.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" onsubmit="uploadpop(this);" method="post" encType="multipart/form-data"
runat="server">
<TABLE class="navigation" id="tbNavigation" cellSpacing="0" cellPadding="0" width="100%"
border="0">
<TR>
<TD align="right"><asp:panel id="Panel4" runat="server" CssClass="panelButtons" Width="800px">
<asp:button id=btSave tabIndex=3 runat="server" CssClass="butt" Text="Speichern"></asp:button>
<asp:button id=btBack tabIndex=3 runat="server" CssClass="butt" Text="Zurück"></asp:button>
<asp:button id=btLogout tabIndex=3 runat="server" CssClass="butt" Text="Logout"></asp:button>
</asp:panel></TD>
</TR>
<tr>
<TD align="left"><asp:panel id="Panel1" runat="server" CssClass="panelBreadcrumb"></asp:panel><asp:label id="lbBreadCrumb" runat="server" Font-Bold="True"></asp:label></TD>
</tr>
</TABLE>
<asp:label id="lbWarten" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 248px" runat="server"
Height="40px" ForeColor="Red" Font-Size="Medium" Width="536px">bitte warten...</asp:label><asp:panel id="panelUpload" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 96px"
runat="server" Height="104px" Width="528px">
<asp:label id=Label1 runat="server" Width="304px">Dateiauswahl:</asp:label><INPUT
id=uploadFile1 style="WIDTH: 536px; HEIGHT: 22px" type=file size=70
runat="server"> <INPUT id=uploadFile2 style="WIDTH: 536px; HEIGHT: 22px"
type=file size=70 runat="server"> <INPUT id=uploadFile3
style="WIDTH: 536px; HEIGHT: 22px" type=file size=70 runat="server"> <INPUT
id=uploadFile4 style="WIDTH: 536px; HEIGHT: 22px" type=file size=70
runat="server"> <INPUT id=uploadFile5 style="WIDTH: 536px; HEIGHT: 22px"
type=file size=70 runat="server">
</asp:panel></form>
<script language="javascript">
document.getElementById("lbWarten").style.visibility = "hidden";
function uploadpop(inForm)
{
document.getElementById("lbWarten").style.visibility = "visible";
if(inForm.uploadFile1 != null)
{
if( inForm.uploadFile1.value !=""
|| inForm.uploadFile2.value !=""
|| inForm.uploadFile3.value !=""
|| inForm.uploadFile4.value !=""
|| inForm.uploadFile5.value !="")
{
strUniqueID = Math.floor(Math.random() * 1000000) * ((new Date()).getTime() % 1000);
thePos = inForm.action.indexOf("?");
/*
if (thePos >= 0)
inForm.action = inForm.action.substring(0, thePos);
inForm.action += "?guid=" + strUniqueID + "&cancel=1";
*/
if (thePos >= 0)
inForm.action += "&guid=" + strUniqueID + "&cancel=1";
else
inForm.action += "?guid=" + strUniqueID + "&cancel=1";
window.open("DMProgressBar.aspx?guid=" + strUniqueID,"","toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,height=275,width=600,top=70,left=100");
}
}
inForm.submit();
return true;
}
function ClearInput()
{
node = document.getElementById("panelUpload");
if(node != null)
{
// node.removeNode(true);
node.parentNode.removeChild(node);
}
return true;
}
</script>
</body>
</HTML>
I really don´t get, why it doesn´t work.
The aspx upload have to send the file in to a temporary folder called uploads and after the file is uploaded, it have to be sended in to an oder folder wich is reserved depending of the user permissions. I noticed that the file is uploaded and save it just in the temporary folder, but then it nothing happends and I recive, like I say, a parsing error.
I don't know what could be the problem, I really need some help here.
Just an extra thing, if I try to run the aplication under localhost, i get nothing just the Homepage of the website.
it seems below reasons.
The folder where the applicaiton was located did not haev the group "Everyone" on read only mode. After adding "Everyone" it worked fine!!
please check article for more details.
http://forums.asp.net/t/1004395.aspx?What+causes+this+XML+Parsing+Error+no+element+found
http://www.c-sharpcorner.com/Forums/Thread/216997/how-to-resolve-xml-parsing-error-no-element-found.aspx
Related
I have an ASP.Net user control, it has a text box and list box, I have given them unique ids and classes, as a user control if I drag it twice or more on asp.net page, it will not work because of same ids when compiled, please see the code below -
$("#liAutoCompleteTextBox").html("<ul class='ecm-autocomp-light'>");
$("#ddlAutoCompleteTextBox > option").each(function () {
if($(this).text().toLowerCase().match(txtVal)) {
$("#liAutoCompleteTextBox").append("<li class='ecm-autocomp-light' onclick=updateToAutoCompleteTextBox('" + encodeURI(this.text) + "')><a onclick=updateToAutoCompleteTextBox('" +encodeURI( this.text) + "')>" + this.text + "</a></li>");
}
});
The user control has script like above, this is just one example.
And in aspx we have,
<label class="input" id="AutoCompleteTextBoxText" runat="server">
<asp:TextBox ID="txtAutoCompleteTextBox" AutoCompleteType="None" autocomplete="off" onfocusout="$('#liAutoCompleteTextBox').fadeOut()" onkeyup="liAutoCompleteTextBoxFunc()" runat="server" CssClass="input-sm isReq isRestrictedText txtAutoCompleteTextBoxCls"></asp:TextBox>
</label>
<label class="select" style="display: none">
<asp:DropDownList ID="ddlAutoCompleteTextBox" ClientIDMode="Static" runat="server" CssClass="input-sm ddlAutoCompleteTextBoxCls">
</asp:DropDownList>
<i></i>
</label>
<div id="liAutoCompleteTextBox" class="customAutoCompDiv" style="position: absolute; display: none; padding: 5px; border: 1px #808080 solid; background: #fff; z-index: 1000; width: 90.5%;">
</div>
I want to make all the ids completely dynamic. Is there any specific control id which I can use with all the names and classes, or is there any other way to handle this?
If you change the liAutoCompleteTextBox div to a Panel (which is a div in html) and put the script inside the UserControl then it will work. When it is a Panel you have access to it's ClientID. Now no matter how much controls you put on the parent page, the javascript will still reference the correct controls.
<!-- begin user control -->
<label class="input" id="AutoCompleteTextBoxText" runat="server">
<asp:TextBox ID="txtAutoCompleteTextBox" AutoCompleteType="None" autocomplete="off" onfocusout="$('#liAutoCompleteTextBox').fadeOut()" onkeyup="liAutoCompleteTextBoxFunc()" runat="server" CssClass="input-sm isReq isRestrictedText txtAutoCompleteTextBoxCls"></asp:TextBox>
</label>
<label class="select" style="display: none">
<asp:DropDownList ID="ddlAutoCompleteTextBox" ClientIDMode="Static" runat="server" CssClass="input-sm ddlAutoCompleteTextBoxCls">
</asp:DropDownList>
<i></i>
</label>
<asp:Panel ID="liAutoCompleteTextBox" runat="server" CssClass="customAutoCompDiv" Style="position: absolute; display: none; padding: 5px; border: 1px #808080 solid; background: #fff; z-index: 1000; width: 90.5%;"></asp:Panel>
<script type="text/javascript">
$("#<%= liAutoCompleteTextBox.ClientID %>").html("<ul class='ecm-autocomp-light'>");
$("#<%= AutoCompleteTextBoxText.ClientID %> > option").each(function () {
if ($(this).text().toLowerCase().match(txtVal)) {
$("#<%= liAutoCompleteTextBox.ClientID %>").append("<li class='ecm-autocomp-light' onclick=updateToAutoCompleteTextBox('" + encodeURI(this.text) + "')><a onclick=updateToAutoCompleteTextBox('" + encodeURI(this.text) + "')>" + this.text + "</a></li>");
}
});
</script>
<!-- end user control -->
What is important to remember that when the Control and the Control.ClientID are in the same Page/UserControl their ID will be correct.
I created a very basic web application in an attempt to isolate what I think might be a memory leak with a production web app in which the w3wp process consumes memory with each login and doesn’t appear to release that memory. I noticed that my very basic web app was also consuming memory within the iisexpress/w3wp process simply by running the application and hitting refresh on the page. After refreshing the page 20 times the hosting process (iisexpress/w3wp) consumes between 5 MB and 14 MB of memory that it doesn't release. When I take snapshots of the memory using VS 2015's diagnostic tools the amount of memory seems to stay relatively flat.
What would cause this amount of memory to be consumed by the hosting process? What can be done to reduce or eliminate the memory usage?
Out of curiosity I added a call to garbage collection, GC.Collect(3), in the Page_Load event and that seem to keep the memory usage flat. Looking at the memory snapshots before and after the GC.Collect() call doesn't show anything consistently being cleaned up. And this works only if I call GC for each page load. Calling GC each time doesn't seem like much of a solution though.
I am running this on my development machine which is running Windows 10. I am using the default host settings for both IISExpress and IIS. The web app is built from an empty 4.6.1 asp.net web app project. The web app has a single web form page, login.aspx:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebFormTesting.Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="login" method="post" runat="server">
<div>
<div style="height: 250px; width: 500px; position: absolute; left: 380px; top: 120px;">
<div class="clsText10">
<asp:TextBox ID="txtUsername" TabIndex="1" Width="160px" runat="server" ToolTip="Enter User Name"
MaxLength="100" Style="position: absolute; right: 130px; top: 5px;"></asp:TextBox>
<br />
<asp:TextBox ID="txtPassword" TabIndex="2" runat="server" ToolTip="Enter Password"
MaxLength="25" Width="160px" TextMode="Password" Style="position: absolute; right: 130px; top: 50px;"></asp:TextBox>
<br />
<asp:Label ID="Label1" runat="server" CssClass="clsText10"
Style="font-weight: bold; position: absolute; right: 120px; top: 85px;" Text="(Please note: Password values are case sensitive.)"></asp:Label>
<asp:Button ID="btnLogin" TabIndex="3" runat="server" Text="Login" CssClass="btn btn-primary"
ToolTip="Verify User Name and Password" OnClick="btnLogin_Click" Width="120"
Style="position: absolute; right: 180px; top: 180px;"></asp:Button>
<div>
<asp:Label ID="lblUsername" Text="User Name: " runat="server" Style="position: absolute; right: 310px; top: 5px;"></asp:Label>
<br />
<asp:Label ID="lblPassword" Text="Password: " runat="server" Style="position: absolute; right: 310px; top: 50px;"></asp:Label>
<br />
<asp:Label ID="txtError" runat="server" Visible="true" Style="z-index: 100; width: 450px; text-align: right; position: absolute; top: 115px; right: 130px;"></asp:Label>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
With the code behind page, Login.aspx.cs:
using System;
namespace WebFormTesting
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//
}
protected void btnLogin_Click(object sender, EventArgs e)
{
//
}
}
}
I use Master Page in my Project.But Master Page contents are not same in all pages.In Home.aspx page it's margin is 0px and in other page isn't. Texts are Bold and Big Size in one page and Small in another Page. Why this occur?
My Master.master page Code :
<body style="margin:0px; text-align: left;">
<form id="form1" runat="server">
<div>
<div class="auto-style1" style="background-color: #3399FF; height: 42px;">
<h2>
<asp:Label ID="homeLabel" runat="server" Text="Home"></asp:Label>
</asp:Label>
<asp:Label ID="file_sharedLabel" runat="server" Text="Files Shared"></asp:Label>
<asp:Label ID="blogLabel" runat="server" Text="Blogs"></asp:Label>
</h2>
</div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
And Two picture of Home.aspx and Members.aspx are
What happens I don't Catch .
Again, it is hard to tell what is going on without the actual HTML from your child pages. However, judging from the picture, you are probably looking for a margin value on a an element between your <asp:ContentPlaceHolder> tags.
It looks like your second page is using a <table> of some sort.
Make sure your table has:
style="margin-top: 0px;"
Or
<table class="noTopMargin"> ...
<style>
.noTopMargin { margin-top: 0px; }
</style>
As for the font-size and font-weight being messed up, it is possible that your second page has a <style> declaration somewhere which is screwing it all up. Also make sure that your browser zoom is the same between both pages.
I am using ASP.NET 2.0 and AJAX extension tool.
I already created loading indicator on button submit. When I will click the button, the loading indicator will show after redirecting to the next page. But, I want to hide the page until processing has completed (after that redirect to next page).
I am using the following code:
<td style="width: 100px; height: 26px;">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" DynamicLayout="false" runat="server">
<ProgressTemplate>
<img src="Images/loading.gif" alt="Images/loading.gif" style="z-index: 100; left: 21px; position: absolute; top: 64px" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<dx:ASPxButton ID="btnOk" ClientInstanceName="btnok" runat="server" Style="z-index: 100; left: 90px; position: absolute;
top: 108px" Text="OK" Width="61px" BackColor="Gainsboro" OnClick="btnOk_Click" AutoPostBack="False" >
<DisabledStyle>
<Border BorderColor="Teal" />
</DisabledStyle>
<ClientSideEvents Click="function(s, e) {
ShowloadingImage();
}" />
</dx:ASPxButton>
</ContentTemplate>
</asp:UpdatePanel>
To "hide" your page you can make an overlay div over all, using this css
.OverAll
{
height:100%;
width:100%;
position:fixed;
left:0;
top:0;
z-index:2 !important;
background-color:black;
}
using jquery we can hide the page on page loading...I am using following code
$(function() {
($.unblockUI);
$('#pnlLogin_btnOk').click(function() {
$.blockUI({ message: '<img src="Images/loading.gif" />' });
});
});
I have a gridview with certain boxes that are highlighted in green. These boxes should fill the entire box, but I can't seem to trash this 1px border around the edges. I'm using IE7, but FF does it too.
Rendered html
<!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><title>
</title><link href="Style/StyleSheet.css" rel="stylesheet" type="text/css" /><link href="App_Themes/Contoso/Style.css" type="text/css" rel="stylesheet" /></head>
<body>
<form name="form1" method="post" action="GridViewColoring.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODIyMTgxMzQxZBgBBQh0ZXN0R3JpZA88KwAMAQgCAWR6Qz5BuXEoalr4HjsTfYqqKPrdwd2ICIXpeNacwdi46w==" />
</div>
<div>
<div>
<table class="cssTable" cellspacing="0" rules="all" border="1" id="testGrid" style="border-collapse:collapse;">
<tr>
<th scope="col">Description</th><th scope="col">Serial#</th>
</tr><tr style="background-color:Yellow;">
<td class="NoMargin NoPadding" style="font-size:Smaller;">
<span id="testGrid_ctl02_descriptionLbl">Some desc 1/25/2011 9:51:27 AM</span>
</td><td style="font-size:Smaller;">
<span id="testGrid_ctl02_serialNumberLbl" class="NoMargin NoPadding MaxHeightAndWidth NoBorder" style="display:inline-block;height:100%;width:100%;">0</span>
</td>
</tr><tr style="background-color:Yellow;">
<td class="NoMargin NoPadding" style="font-size:Smaller;">
<span id="testGrid_ctl03_descriptionLbl">Some desc 1/25/2011 9:51:27 AM</span>
</td><td style="font-size:Smaller;">
<span id="testGrid_ctl03_serialNumberLbl" class="NoMargin NoPadding MaxHeightAndWidth NoBorder" style="display:inline-block;background-color:#CCFFCC;height:100%;width:100%;">1000</span>
</td>
</tr><tr style="background-color:Yellow;">
<td class="NoMargin NoPadding" style="font-size:Smaller;">
<span id="testGrid_ctl04_descriptionLbl">Some desc 1/25/2011 9:51:27 AM</span>
</td><td style="font-size:Smaller;">
<span id="testGrid_ctl04_serialNumberLbl" class="NoMargin NoPadding MaxHeightAndWidth NoBorder" style="display:inline-block;background-color:#CCFFCC;height:100%;width:100%;">2000</span>
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
test case
CSS
body {
}
.NoMargin
{
margin:0 0 0 0;
}
.NoPadding
{
padding:0 0 0 0;
}
.BgColor
{
background-color:Aqua;
}
.MaxHeightAndWidth
{
height:100%;
width:100%;
}
.NoBorder
{
border:0px;
}
ASP.NET
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="GridViewColoring.aspx.cs" Inherits="WebApplication1.GridViewColoring" %>
<!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 runat="server">
<title></title>
<link href="Style/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView id="testGrid" runat="server" CssClass="cssTable"
AutoGenerateColumns="False"
OnRowDataBound="SetStatusColors" >
<Columns>
<asp:TemplateField HeaderText="Description" SortExpression="description" ItemStyle-CssClass="NoMargin NoPadding">
<ItemTemplate>
<asp:Label ID="descriptionLbl" runat="server" Text='<%# Bind("description") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Font-Size="Smaller" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Serial#" SortExpression="serial">
<ItemTemplate>
<asp:Label ID="serialNumberLbl" runat="server" Text='<%# Bind("serial") %>' CssClass="NoMargin NoPadding MaxHeightAndWidth NoBorder" Height="100%" Width="100%"></asp:Label>
</ItemTemplate>
<ItemStyle Font-Size="Smaller" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
C# backend
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace WebApplication1
{
public partial class GridViewColoring : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
testGrid.DataSource = MakeTable();
testGrid.DataBind();
}
protected void SetStatusColors(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i < testGrid.Rows.Count; i++)
{
string serialNumber = ((Label)testGrid.Rows[i].FindControl("serialNumberLbl")).Text;
if (serialNumber != "0")
{
//GREEN HIGHLIGHTS
((Label)testGrid.Rows[i].FindControl("serialNumberLbl")).BackColor = System.Drawing.Color.FromArgb(204, 255, 204);
}
testGrid.Rows[i].BackColor = System.Drawing.Color.Yellow;
}
}
//mock db
private DataSet MakeTable()
{
var table = new DataTable("ParentTable");
DataColumn column;
DataRow row;
// Create new DataColumn, set DataType,
// ColumnName and add to DataTable.
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "serial";
column.ReadOnly = true;
// Add the Column to the DataColumnCollection.
table.Columns.Add(column);
//// Create second column.
column = new DataColumn();
column.DataType = System.Type.GetType("System.String");
column.ColumnName = "description";
column.AutoIncrement = false;
column.Caption = "Description";
column.ReadOnly = false;
column.Unique = false;
// Add the column to the table.
table.Columns.Add(column);
// Instantiate the DataSet variable.
var dataSet = new DataSet();
// Add the new DataTable to the DataSet.
dataSet.Tables.Add(table);
// Create three new DataRow objects and add
// them to the DataTable
for (int i = 0; i <= 2; i++)
{
row = table.NewRow();
row["serial"] = i * 1000;
row["description"] = "Some desc " + DateTime.Now;
table.Rows.Add(row);
}
return dataSet;
}
}
}
Update
Changed the Serial# template's itemstyle and it fixed the problem. I have no idea why, but thanks to your tips, I was able to reduce the problem down enough to try it:
<ItemStyle Font-Size="Smaller" CssClass="NoMargin NoPadding" />
Try setting border-collapse: collapse; on the cssTable css class.
Okay I was able to get it working. I took the css classes off of the first template item and created the following css.
table.cssTable
{
border-collapse: collapse;
}
table.cssTable tr td
{
background: Yellow;
font-size:Smaller;
margin: 0;
padding: 0;
}
By the way, you should be able to get rid of the ItemStyle with font-size as well with this CSS.
I've created a fiddle but can't really see the problem I'm afraid - http://jsfiddle.net/5rBYb/1/
You might want to try adding this to your CSS though, which will set the borders to a single pixel (which I suspect is what's causing your problem).
table, th, td { border: 1px solid #000; }
Just change it to border: 0 if you want to hide borders.