Archive

Archive for the ‘ASP.NET’ Category

White space (blank line) top of the ASP.Net Menu in IE8

September 2, 2009 amiraryani Leave a comment

Following my previous post about applying a hot fox for ASP.Net menu control, I discovered that the z-index is not the only issue to fix. ASP.Net control when it gets rendered in IE8 shows a gap on top of it like a blank line or a white space.  Sakya found out and explains on his blog that it is the result of SkipLinkText which is not rendered in IE7 but IE8 render it.

The following code snippet shows how to set SkipLinkText to blank.

<asp :Menu ID="Menu1"  runat="server"
     DataSourceID="SiteMapDataSource1"
     SkipLinkText="">
</asp>

For more information refer to http://blogs.iis.net/sakyad/archive/2009/04/11/asp-net-menu-control-getting-padded-with-white-space-on-ie8.aspx.

Categories: ASP.NET Tags: , ,

Make the ASP:Login control centre

August 26, 2009 amiraryani Leave a comment

Following my previous post you cannot use “p” or “div” tags to align a ASP:Login control to the center of the page. So to get this done, you need to set the margin property of the control to “auto”.

<body>
    <form id="form1" runat="server">
<div>
        <asp :login runat="server" Style="margin:auto"></asp></div>
</form>
</body>

Align a table in the middle of an HTML | XHTML page

August 26, 2009 amiraryani Leave a comment

In the past it was common to align a table in the middle of a HTML page using the following code:

<div align="center">
<table>
<tr>
<td>
        Test String</td>
</tr>
</table>
</div>

However, this is no longer working as in the new XHTML standards “align” is not a valid attribute of

. So a better solution is to set the margin of the table to “auto”. You can delete the
as it is no longer needed for this purpose:

  <table style="margin: auto;">
    <tr>
      <td>
        Test String
      </td>
    </tr>
  </table>
Categories: ASP.NET Tags: , , ,

ASP.Net menu does not work in IE8

August 24, 2009 amiraryani Leave a comment

The first problem which I found with the ASP.Net applications runing on IE8 was the dynamic menu. It does not invoke correctly as the default value for Z-Index is no longer valid for IE8. The problem and the work around it, is explained in

http://support.microsoft.com/kb/962351

In addition, the following list of issues and hotfixes related to ASP.Net 2 are important to review:

961847 FIX: Error message when you view a page in design mode after you recompile a .NET Framework 3.5 Service Pack 1-based project: “Error creating control – ‘ControlInstanceName [text]‘ could not be set on property ‘PropertyName’”

961864 FIX: Web clients may have several problems when you access an ASP.NET 2.0 AJAX-enabled Web site

961884 FIX: You experience very slow performance on an initial request to an ASP.NET Web site after you change the App_Code folder, the bin folder, or the Global.asax file

962351 FIX: The pop-out menus are not displayed when you use Internet Explorer 8.0 in Standards mode to view an ASP.NET Web page that has dynamic menus

961902 FIX: Error message when you compile an ASP.NET project that contains many application resource files: “A first chance exception of type ‘System.ArgumentException’ occurred in mscorlib.dll”

968392 Error message and the hyperlink control is not rendered if the ImageUrl property is set in Visual Studio 2005 or Visual Studio 2008 after you install .NET Framework 2.0 Service Pack 2 or .NET Framework 3.5 Service Pack 1:”Object reference not set to an instance of an object”

Reference: http://support.microsoft.com/?id=969612

Other blog posts related to this issue:

Repair .Net 2: missing Netfx20a_x86.msi

June 30, 2009 amiraryani Leave a comment

In my previous post I mentioned about a repair process for .Net 2 in order to host WCF in IIS . However, after following Microsoft instruction on repair process you may face an annoying issue where Windows installer can not find Netfx20a_x86.msi.

Netfx20a_x86.msi is a component of .Net 3.5 and it will get extracted to a folder such as “C:\5409af1fab5096fc4d07947959\wcu\dotNetFramework\dotNetFX20″ as part of the install process. I tried to extract the file from the folder and use it for repairing .Net 2.0 but it did not work. After providing the msi file it will look for the setup.exe.

Solution: Ignore repairing .Net 2 and repair .Net 3 (or 3.5 if installed). In my case repairing .Net 3.5 fixed the issue in IIS.

Order of events from Parent to Child ASP Pages

February 23, 2009 amiraryani Leave a comment

I wonder in which order the Form_Load events get fired when there is a hierarchy of pages, i.g., MyPage is inherited form ParentPage class, and ParentPage class is inherited from ParentParentPage .

The answer is: the load events fire from parent to child. Therefore it will be:

1. ParentParentPage 

2. ParentPage 

3. MyPage

Categories: ASP.NET

Conflict in Form Authentication between two web sites

January 8, 2009 amiraryani Leave a comment

 

I faced a problem with authentication which sounds like conflicting between  user identity between two web sites.

Problem description: Two ASP.Net 2 web sites were deployed to the  production environment and both use Form Authentication. If a user access these  sites from two tabs of an explorer window, as soon as he login in the second web  site it reset the authentication on the first web site, i.e, change  Request.IsAuthenticated to False and Me.Page.User.Identity.Name to BLANK in the  first web site.

In both web sites:

set in the web.config:

<authentication mode="Forms">

And there is login page which authenticate the user with a code such as


Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
  System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate  

  If Login1.UserName = "U1" And Login1.Password = "PASS" Then  

    FormsAuthentication.RedirectFromLoginPage(Login1.UserName, False)  

    e.Authenticated = True
  End If
End Sub  

These websites individually work fine and  Request.IsAuthenticated hold its value with no problem. The problem only occurs  if the other website accesses trhough a different tab of the same browser. Also I tested these websites work if they installed on different  Servers.

I posted this problem to Microsft ASP.Net Forum where I found the cause and the solution of the problem.

Solution:

This problem occures  because no unique name assigned to the Authentication element. The Authentication element should contain a Forms subelement and Forms has the Name attribute which should be unique for each website.

Example:

<system .web>
  <authentication mode="Forms">
     <forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH"></forms>
  </authentication>
</system>

In my case the problem could be fixed by changing the Web.config as follow.

Website 1:


</authentication><authentication mode="Forms">
<forms name ="App1Cookie" loginUrl="login.aspx"
  defaultUrl="default.aspx" timeout="20"></forms>
</authentication>  

Website2


<authentication mode="Forms">  

<forms name ="App2Cookie " loginUrl="login.aspx" 
 defaultUrl="default.aspx" timeout="20"></forms>
</authentication>  

Reference: http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx

Categories: ASP.NET