Microsoft Knowledge Base Email Alertz

(835390) - Explains that events are not raised when you run HTML controls as server controls if you specify your computer name as the server name while creating a Web Application project in Windows Server 2003.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 835390 - Last Review: May 17, 2007 - Revision: 1.8

Events are not raised for HTML controls that you run as server controls in Windows Server 2003

System TipThis article applies to a different version of Windows than the one you are using. Content in this article may not be relevant to you. Visit the Windows Vista Solution Center

On This Page

SYMPTOMS

In Microsoft Visual Studio .NET, you can run HTML controls as server controls in a Microsoft ASP.NET Web Application project. However, when you run the corresponding Web application in Microsoft Windows Server 2003, you may notice that the events of the HTML controls are not raised.

Note This behavior only occurs in Windows Server 2003.

WORKAROUND

To work around this behavior, add the server name that you used to create your ASP.NET Web application to the list of trusted Web sites in Microsoft Internet Explorer, and then specify the default security settings for trusted Web sites. To do this, follow these steps:
  1. Start Internet Explorer.
  2. On the Tools menu, click Internet Options. The Internet Options dialog box appears.
  3. On the Security tab, click Trusted sites, and then click Sites. The Trusted sites dialog box appears.
  4. In the Add this Web site to the zone box, type the server name that you used to create your ASP.NET Web application, and then click Add. For example, depending on the server name that you specified when you created the project, you may type either localhost or Server_Name.
  5. Click Close, click Default Level, and then click OK.
  6. Run your ASP.NET Web application. The problem that is mentioned in the "Symptoms" section of this article does not occur.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Visual Studio .NET.
  2. Use either Microsoft Visual Basic .NET or Microsoft Visual C# .NET to create an ASP.NET Web Application project. By default, the WebForm1.aspx file is created.

    Note You may specify either "localhost" or "Server_Name" as the name of the server when you create the project.
  3. Add a Button control to the WebForm1 Web form.
  4. On the WebForm1 Web form, right-click Button, and then click Run As Server Control.
  5. Double-click Button, and then add the following code to the Button1_ServerClick event handler.

    Visual Basic .NET code
    Button1.Value = "Test"
    Visual C# .NET code
    Button1.Value = "Test";
  6. Build and then run the project. The WebForm1 Web form appears.
  7. Click Button. The text does not change from "Button" to "Test". This behavior indicates that the Button1_ServerClick event is not raised.
  8. Quit Internet Explorer.
  9. In Visual Studio .NET, set a breakpoint on the line of code that you added in step 5.
  10. Build and then run the project. The WebForm1 Web form appears.
  11. Click Button. The control does not reach the breakpoint. Therefore, the Button1_ServerClick event is not raised.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
http://msdn2.microsoft.com/en-us/library/t5d54cf8(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/t5d54cf8(vs.71).aspx)

http://msdn2.microsoft.com/en-us/library/aa719973(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/aa719973(vs.71).aspx)

APPLIES TO
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
Keywords: 
kbwebserver kbhtmlobj kbhtml kbservercontrols kbevent kbprb KB835390
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate