.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

HTML comments in ASPX file causes exception

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

Hi, I'm new to ASP.NET MVC 2 but I've done webforms programming. In my first MVC2 test project in VS 2010 I got an error that surprised me. Code inside HTML comment tags are obviously parsed and sometimes even causes exceptions. This seems to me like a strange break with a programming paradigm that is as old as programming itself.

The code section in question is a form inside a user control.

Code that runs OK:

   <% using (Html.BeginForm("Index", "Search")) {%>
            <input id="SearchText" name="SearchText" type="text" />
            <input type="submit" value="Search..." />
    <% } %>

Code that causes YSOD:

   <% using (Html.BeginForm("Index", "Search")) {%>
            <!--<asp:TextBox ID="AccountText" runat="server" Width="226px"></asp:TextBox>-->
            <input id="SearchText" name="SearchText" type="text" />
            <input type="submit" value="Search..." />
    <% } %>

The error message given is Control 'c

View Complete Post

More Related Resource Links

How to change the content of an html file using an aspx file?


Hi everyone,

I would really like to have a little help, it should be easy but i can't find the answer

and it's been a while since iv'e done something with asp.net..

what i have now is a regular html pages website.

in some of the pages i have galleries,

I would like to make an aspx page to manage the content of the galleries or any other set-in advance content.

It's kind of a CMS, but it's not, since i would not be using a database.

what i want is just to get the admin's content from the aspx page

and send it to overwrite the images or the content of the DIVS in the html page.

at the final outcome, i will only want to have html files and one aspx file for the admin's editing use.

what is the most simple way to do that without using CMS? 

Thanks a bunch!


Launch CMD File From ASPX Page


My organization uses a CMD file to install updated files for a major enterprise application. Currently, we send out an email to users with a link to the file and instructions to run it, BUT inevitably users don't update their machines until their in field and try to start the app.


We're now liking the idea of using an ASPX page to prompt the users to run the updates and to capture the fact that the updates have been run. I realize that we can't capture the success or failure of the update. But we'd like to capture the user accessed the page.


Is it possible to embed into the markup for the page a link to the file on the local intranet that the users can click on to run the file?

The user accessing the page would capture that they did just that. We'd deal with wether or not the update was actually installed or if it failed later with them directly.

>>>How to use javascript function in aspx file?



I have a file util.js and there some funtions in same file.

For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

Anyone have idea. Do share with me.

I used the reference like this:


' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">

Calling parameterized method from aspx file


Hi all,
I have following method
 public string GetYoutubeVideo (string code)
        return "asasdasfa"

Writing the windows forms data to an HTML file

I have a windows forms application ready now i need to transfer data from the windows forms to the web and to do this i need to write an HTML file that contains the form data, i mean the data contained in the form should be written to an HTML file to be submitted and this HTML file should be generated on the local PC. I have the code for the HTML file but how can i write this HTML file with the data values contained in my windows forms. Please give your suggestions. Best Regards, Syed

HTML act differently in aspx and html

Hi i want to put the text in the vertical middle of the <td> it works fine in .html page but if i use it in .aspx, then it goes to the top of the <td> This is the script i use  <table border="1px"> <tr> <td style="height: 100px" valign="middle"> This should be in the middle</td> </tr> </table>   is there any way to put the text in the vertical middle of the  <td>??

NullReference Exception when editing an xml file in C#

When trying to add new node to Category node, I get categoryNode is null, but it exists in xml file CODE: XmlDocument     xmlDoc = new XmlDocument(); xmlDoc.Load(requestPath);     XmlNode categoryNode = xmlDoc.SelectSingleNode("CATEGORY");     XmlNode newNode = xmlDoc.CreateElement("REQUEST");     XmlAttribute newAttribute = xmlDoc.CreateAttribute("description"); newAttribute.Value = request.GetId(); newNode.InnerText =   "blank"; newNode.Attributes.Append(newAttribute); categoryNode.AppendChild(newNode); xmlDoc.Save(requestPath);   FILE: <GROUP description="Kwang">   <CATEGORY description="soo">blank</CATEGORY>   </GROUP>

Exception occured:_layouts/MyAssocForm.aspx does not exist.

HI while attaching workflow to document library, it gave the error message as Exception occured:_layouts/MyAssocForm.aspx does not exist. I check for aspx page in "layouts" location but no file is exist. I created Infopath forms and attached to workflow, Here is my workflow.xml class <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Workflow Name="FormBase" Description="This workflow ..." Id="555F6853-87FE-4668-B7AF-BD5749B1CDCA" CodeBesideClass="Formbase.Workflow1" CodeBesideAssembly="Formbase, Version=, Culture=neutral, PublicKeyToken=9d4763c102f02820" TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160" AssociationUrl="_layouts/MyAssocForm.aspx" InstantiationUrl="_layouts/MyInitForm.aspx" ModificationUrl="_layouts/MyModForm.aspx" > <Categories/> <MetaData> <Modification_GUID_Name>Name of Modification</Modification_GUID_Name> <Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:DemoInitiation:-myXSD-2010-09-06T08-55-14</Instantiation_FormURN> <Association_FormURN>urn:schemas-microsoft-com:office:infopath:DemoInitiation:-myXSD-2010-09-06T08-55-14</Association_FormURN> <Task0_FormURN>urn:schemas-microsoft-com:office:infopath:Editform:-myXSD-2010-09-06T09-16-40&

Linking JS file to ASPX page or content page

Hi, I moved my JS functions into an external file "JScript.js", because I'm now using a master page and a content page.But it doesn't work any more, and I can't find why.I tried simply to link a js file to an ASPX file, by adding to the script manager the path of my script, but it doesn't work.Here is my js file (we don't need any special things in it do we?) var step1 = false; function pageLoad() { var accCtrl = $find('AccordionCtrl_AccordionExtender'); accCtrl.add_selectedIndexChanged(onAccordionPaneChanged); } function hideAccordionPane(paneNo) { ... } function changeSelected(idx) { ... } function onAccordionPaneChanged(sender, eventArgs) { ... } function check() { ... }And here is my ASP code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

How to change the split view when editing an aspx file

I've been using SPD 2010 more and more over the past few weeks.  However, when there's a navigation bar on the left, toolbox on the right, ribbon above and split view of code and design in the middle, there's just not enough room on the screen - (I have 2 LCDs at 1280x1024).  I can spread the window accross both monitors but that's not much use unless, I can change the split between code and design from horizontal to vertical. Is this possible?  Help apprieciated. Cheers, Bill

Changes in the values of controls of .cs file not reflecting on .aspx webpage while execution.

In my code I am assigning certain values to labels from data reader.While debugging I can see that proper values are assigned but the changes are not reflecting in the end of debug on the webpage that are executing.// My Code// Question.aspx.csusing System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Examinee_Question : System.Web.UI.Page{    ExamFunctions ef = new ExamFunctions();    SqlConnection con,con1;    SqlCommand cmd,cmd1;    SqlDataReader dr,dr1;    String QType="";    int ctr = 1;    protected void Page_Init(object sender, EventArgs e)    {        con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Db.mdf;Integrated Security=True;User Instance=True");        con.Open();        con1 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Db.mdf;Integrated Security=True;User Instance=True&qu

Access Javascript from an aspx file through another aspx file

Hello, So.. I have a file called myFile.aspx which is linked to a js file called myJS.js    There is a file linked to an entirely different frame called theOtherFile.aspx.  I want to access a function is myJS.js called myFunc in theOtherFile.aspxI am not entirely sure how I would accomplish that..I am quite new to MVC2 and JS, so I am quite confused as to how to do this.  Any suggestions would be much appreciated.~Anath

Write html file through webservice

I am writing an application in which I want to generate dynamic html file based on the parameters of jquery objects. I want to pass the parameters to a webservice which will produce the required html page. How I can achieve it. Is there any other good approach to this problem.

File Not Found Exception from iiscore.dll

Create a asp.net mvc project with the default template  and used bmc appsight to monitor the w3wp process ; so when ever an action is clicked an exception is occured in iiscore.dll here is the sample one which i got.  Log Entry 530641OperationOpen "\\?\C:\CRAPPYTEST\HOME\ABOUT"CommentThe system cannot find the path specified. ProcessW3WP.exe:5436:5844Causality ID: {0B49C343-7918-4721-A53E-FFD4C7A1C35D}Moduleiiscore.dllTimeStart - Sep 14 18:39:43.913035Duration - 0.000121Stack Dumpiiscore.dll, 0x5d65fddciiscore.dll, 0x5d64b7b3iiscore.dll, 0x5d64fe97iiscore.dll, 0x5d65270fiiscore.dll, 0x5d6562dfiiscore.dll, 0x5d656338iiscore.dll, 0x5d65084eWEBENGINE.DLL, 0x5c8c289bWEBENGINE.DLL, 0x5c8c28d0System.Web.ni.dll, 0x1e7cdd3dSystem.Web.ni.dll, 0x1e7cdb80mscorwks.dll, 0x71761e6fmscorwks.dll, 0x719ba26emscorwks.dll, 0x718bdf6fmscorwks.dll, 0x719ba3a9mscorwks.dll, 0x718bef35mscorwks.dll, 0x719ba42dWEBENGINE.DLL, 0x5c8c7a2eWEBENGINE.DLL, 0x5c8c34cfmscorwks.dll, 0x718bea90mscorwks.dll, 0x718be3a2mscorwks.dll, 0x718be516mscorwks.dll, 0x718a1ec9kernel32.dll, 0x76881194ntdll.dll, 0x76f8b3f5ntdll.dll, 0x76f8b3c8

Crwaling Network file shares and HTML Sites

Hi, Recently we have enabled Incremental crawling.Now our customer requirement is they are expecting search to crawl Network files,HTML sites.Should we change any settings in the Search.Please let us know Thanks & Regards, Sudheer

Reg:Html interaction with aspx page

hello All, Does anyone know how to call or is it possible to call server side method(aspx.cs) from .html page please help

How to dynamically create HTML file from the code ?

Hi all,Precisely and concisely, I have aspx page that has only one button "Generate". If the user clicked on this button, one HTML page should be created. The created HTML page should have title "Home" and the Body should contain "Hello World". 1) What is the code that should be written inside "Generate" button in order to accomplish this functionality? 2) Assuming the HTML page gets created, How to store it inside specific folder on the local drive? Or how to store it inside DB? I would greatly appreciate any constructive input!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend