Category Archives: ASP.Net 2.0

.NET ASP.Net ASP.Net 2.0 Microsoft

Problem with Session in iFrame after windows update

Microsoft ASP.NET will now emit a SameSite cookie header when HttpCookie.SameSite value is “None” to accommodate upcoming changes to SameSite cookie handling in Chrome. As part of this change, FormsAuth and SessionState cookies will also be issued with SameSite = ‘Lax’ instead of the previous default of ‘None’, though these values can be overridden in web.config.

You have to set the cookieSameSite= “None” in the session state tag to avoid this issue. I have tried this and working well.

<system.web>
<sessionState cookieSameSite="None"  cookieless="false" timeout="360">
</sessionState> 
</system.web>

https://social.msdn.microsoft.com/Forums/en-US/1b99630c-299c-446e-bf4b-d7d4d74bf9ef/problem-with-session-in-iframe-after-recent-windows-update?forum=aspstatemanagement

.NET ASP.Net 2.0 IIS

The page was not displayed because the request entity is too large. iis7

“The page was not displayed because the request entity is too large.”

 

I think this will fix the issue IF you have SSL enabled:

Setting uploadReadAheadSize in applicationHost.config file on IIS7.5 would resolve your issue in both cases. You can modify this value directly in applicationhost.config.

1) Select the site under Default Web Site

2) Select Configuration Editor

3) Within Section Dropdown, select “system.webServer/serverRuntime”

4) Enter a higher value for “uploadReadAheadSize” such as 1048576 bytes. Default is 49152 bytes.

During client renegotiation process, the request entity body must be preloaded using SSL preload. SSL preload will use the value of the UploadReadAheadSize metabase property, which is used for ISAPI extensions

Reference: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true

 

Code Snippets .NET ASP.Net 2.0

Pass Array via Query String

http://galhano.com/?var=1&var=2&var=3&var=4

vb sample:

  Dim arr = Request.QueryString(&quot;var&quot;).Split(&quot;,&quot;)
  For Each s In arr
    Response.Write(&quot;&lt;br /&gt;var:&quot; &amp; var)
  Next
Code Snippets ASP.Net ASP.Net 2.0

Add value for dropdown list in asp.net


ListItem li =new ListItem();
 li.value=&quot;PT&quot;;
 li.Text=&quot;Portugal&quot;;
 dropdownlist1.Items.Add(li);

or


dropCategory.Items.Add( New ListItem( &quot;Portugal&quot;, &quot;PT&quot; ) )

.NET AJAX ASP.Net 2.0 Microsoft

.NET Framework 4 Chart Controls

You can now download Visual Studio 2010 projects that contain all the samples targeting .NET Framework 4.

The samples environment for Microsoft Chart Controls for .NET Framework contains over 200 samples for both ASP.NET and Windows Forms. The samples cover every major feature in Chart Controls for .NET Framework. They enable you to see the Chart controls in action as well as use the code as templates for your own web and windows applications.

ChartSamples_thumb_1.jpg

The samples environments each contains a Getting Started section to help you start using the Chart controls quickly. The samples demonstrates how to use the following features in Microsoft Chart Controls for .NET Framework:

  • All supported chart types.
  • Data series, chart areas, axes, legends, labels, titles, and more.
  • Data Binding
  • Data manipulation, such as copying, splitting, merging, alignment, grouping, sorting, searching, filtering, and more.
  • Statistical formulas and financial formulas.
  • Advanced chart appearance, such as 3D, anti-aliasing, lighting, perspective, and more.
  • Chart rendering.
  • Events and Customizations.
  • Interactivity and AJAX.

http://archive.msdn.microsoft.com/mschart

.NET ASP.Net 2.0 Microsoft

Remove Black Arrows from horizontal ASP.Net menu

<asp:Menu ID=”Menu1″ runat=”server” DataSourceID=”SiteMapDataSource1″
Orientation=”Horizontal” >

Set:

staticEnableDefaultPopOutImage= False

use your own image:

StaticPopOutImageUrl=”~/images/down_arrow.gif”

.NET ASP.Net 2.0 Chrome

Asp.net menu control not working on Google Chrome

To solve this you will need to tell .net the capabilities of the browser. For .net 2.0 & above you need to create a new browers file with the capabilities and upload it to your server.

  1. In VS2008 Solution Explorer right click your application and add the “ASP.Net Folder” App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser (if fixing the problem for Chrome)
  3. Delete all the default stuff VS put in this file and replace it with the following:
    <browsers>
    <browser refID=”safari1plus”>
    <controlAdapters>
    <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” />
    </controlAdapters>
    </browser>
    </browsers>
  4. Save your file & test locally to see if all is well.
  5. Now for the annoying bit. Upload the new app_browser folder & file to your production server, if you have used the “copy web site” menu option to upload or sharepoint or frontpage, these will create a new folder under app_browsers called vti_cnf
  6. Manually delete the vti_cnf folder under app_browser on your production server. If you don’t you’ll get “Parse error: Data at the root level is invalid. Line 1, position 1.” in your new safari.browser file.
  7. Remember to manually delete this vti_cnf folder everytime you make a change to the app_browser folder or contained files.

So there you go, how to solve the control rendering problems with Google’s Chrome.

For original post you can visit

http://fabenterprises.wordpress.com/2009/03/21/aspnet-menu-not-rendering-correctly-in-googles-chrome/

.NET ASP.Net 2.0 Microsoft

ASP.NET Web Configuration Guidelines

.NET Framework 4

ASP.NET enables you to specify configuration settings that affect all Web applications on a server, that affect only a single application, that affect individual pages, or that affect individual folders in a Web application. You can make configuration settings for features such as compiler options, debugging, user authentication, error-message display, connection strings, and more.

Configuration data is stored in XML files that are named Web.config.

This topic describes the main configuration settings that you can make in the Web.config file. The topic contains the following sections:

read more »

.NET ASP.Net 2.0

ASP.NET 2.0 – Enter Key – Default Submit Button

One of the most annoying things in developing web pages is handling the “Enter key” for form submission. Enter key has been the favourite way users like to submit forms. Though we provide Buttons to click on, the easiest and intuitive way is that, I can enter some text, make some changes and then hit “Enter” to accomplish my submission.
“Enter” Key is handled in a little tricky way by uplevel browsers like Internet Explorer, when it comes to ASP.NET.

* If there is a single Textbox and single button, then it becomes straight forward, the button is submitted. However, the event code doesnt get executed, though the page postsback.

* If there are two or more, buttons, then it takes up the first button as the default button. However, it still doesnt execute the event handler but just refreshes the page.

You can supress the Enter key event using Javascript. But this would result in other undesirable effects like, any Enter key in the form i.e. within Text Area or basically where large text is entered, would be disabled.

The earlier work around was to associate a javascript function to each Button to verify the that the relevant button is submitted upon Enter key.

ASP.NET 2.0 introduces a wonderful work around for this. By simply specifying the “defaultbutton” property to the ID of the <asp:Button>, whose event you want to fire, your job is done.

The defaultbutton property can be specified at the Form level in the form tag as well as at panel level in the <asp:panel> definition tag. The form level setting is overridden when specified at the panel level, for those controls that are inside the panel.
read more »

Code Snippets ASP.Net 2.0

problema com asp:menu no IE8

O internet explorer 8 se tornou muito, muito mais compatível com os padrões W3C do que as versões anteriores.

A diferença foi tanta que o IE 8 precisou criar o modo de compatibilidade, para que páginas que ainda não são totalmente compatíveis com este padrão possam continuar funcionando.

Desenvolvedores podem configurar seus sites para serem sempre rodados em modo de compatibilidade

Até mesmo o mais inesperado foi atingido pelas mudanças no IE 8 : O webcontrol de menu nativo do ASP.NET não encontrava-se 100% compatível com o W3C e consequentemente os sites que utilizam o webcontrol de menu apenas continuarão funcionando em modo de compatibilidade.

Existe uma solução simples em CSS que os sites que utilizam o webcontrol de menu podem utilizar :

   1: <style type="text/css">
   2: .adjustedZIndex {
   3:      z-index: 1;
   4:     }
   5: </style>

Adiciona-se este estilo em uma masterpage, por exemplo, e define-se como a cssClass do dynamicMenuStyle :

   1: <asp:Menu ID="Menu1" runat="server">
   2:     <DynamicMenuStyle CssClass="adjustedZIndex" />
   3: </asp:Menu>

Sendo que esta última parte pode ser feita através da janela de propriedades.

Sem dúvida esta é a forma mais simples de corrigir o problema. A Microsoft, porém, por obrigação, disponibilizou um patch de correção que resolve o problema do menu. A forma mais fácil de localizar este path é através deste KB .

Se vocês seguirem os links indicados no KB para o patch, encontrarão descrições muito estranhas, se referindo a problemas do IIS entre outros. Ocorre que o patch para o menu do ASP.NET foi discretamente inserido dentro destes outros.

Considerando as dificuldades de instalar isso em provedores, por exemplo, a solução com CSS é bem mais simples

por Dennes Oliveira