转到正文

存档

标签: ASP.NET

Problem

You are coding away on an ASP.NET page, and are trying to isolate a problem within the page.  You have some existing html/controls/markup/in-line code that is being used on the page, and you want to temporarily comment it out while you fix the problem.

Solution

ASP.NET supports a little known feature called “server-side comments” that you can use to completely disable code/controls/html in a page.  Server-side comments in ASP.NET are delimited using a <%-- --%> syntax.  For example:

        
<%--

Commented out HTML/CODE/Markup.  Anything with  this block will not be parsed/handled by ASP.NET.

<asp:Calendar runat="server"></asp:Calendar> 

<%# Eval(“SomeProperty”) %>     

--%>

继续阅读

For some reasons, I want to use javascript to change the text value of asp:Label control.

A very simple solution is that you can get the client id of server control. You can write javascript in .aspx file as follows:

var Hidden = document.getElementById('<%=this.Label_Hidden.ClientID %>');

"Label_Hidden" is the ID name of your asp:Label.  It means that you get the element object of this control. You can see the asp:Label code :

<asp:Label Visible="false" ID="Label_Hidden" runat="server" Text="" ></asp:Label>

However, if you use a externl javascript method , this way will not work.

继续阅读

Error description:

I write a ASP.NET program, I use HttpContext.Current.User.Identity.Name to store users which visit our site. This program runs well when I debug in Visual studio and wee get display the login user successfully. However, the user name cannot be displayed when I run it in IIS 7.0. I'm very confused, why the program runs well at VS but fail at IIS?

Solution:

It's very obviouly that your IIS cannot get the username for the login one. It's because that you enable the anonymouos authentication in your IIS.  You should follow some steps as follows:

Firstly, open you IIS confiuation, Open "Authentication" in "IIS" folders. Just like:

  继续阅读

www.liaoqiqi.com网站PR查询 博客简洁版 博客Google_Site_Map 博客Baidu_Site_Map ?