Showing posts with label Error and Solutions. Show all posts
Showing posts with label Error and Solutions. Show all posts

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.

Posted by Venkat | Labels:

When i faced this issue

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.

I fixed it by putting my Databind  code ie: Gridview Databind code in the Page_Load event in a !Page.IsPostBack block

Solution:

if(!IsPostback)

{
//Bind the Gridview Databind
}

Sys.WebForms.PageRequestManagerServerErrorException

Posted by Venkat | Labels:

When i was worked with Ajax with timer Control i have the task ie: updating the some control inside the UpdatePanel ie: I am refreshing or call the method  at regular intervals. That time i got this error

 Sys.WebForms.PageRequestManagerServerErrorException ... 404 not found

This error occurs only when the page is idle for 1 min or more than 1 min, so i googled to get the solution for this issue. there is number of solution available according the problem and at which situation you are using.

Solution: 

< asp:ScriptManager ID="ScriptManager1" runat="server"   EnablePartialRendering="false" />

Postback not works when using HTTPCompression

Posted by Venkat | Labels: , ,

Some members asked this question on forums. Here is the Solution to overcome this issue.

When i am going to compress the .aspx pages using HTTPCompression, the postback will not works. Because it also compressing the Scripresource.axd, webresource.axd file.

To make the postback works in your project you do not compress the above two files, by adding these code.

Solution:

........,

<httpcompress compressiontype="GZip">
 <excludedpaths>
 <add path="scriptresource.axd">
 <add path="webresource.axd">
</add>
</add>
</excludedpaths></httpcompress>


And one more thing don't compress the images like jpg, gif, jpeg etc.. because its already compressed one. if you compress the image it will degrade the performance. you should the exclude the image from compression.

Solution:

..,
<excludedmimetypes>
 <add mime="image/jpeg">
 </add>
 </excludedmimetypes>

Thanks to all.

Logout issue : Copy the URL of the user page and paste user after logout show the page only IE has Issue

Posted by Venkat | Labels: , ,

When i working on the project ,i faced the issue - that i am sharing to u. ex: When the user login in to his account then do some navigation inside User page - at this stage I copied the URL then i Click Logout button. 

Once i logged out if i paste the Copied URL on that page it redirect to the user Page, when i do some navigation (or clicking any button on that page ) its has been redirect to Login page , but this should not occur  like this if i paste the URL it will directly redirect to the Login page only.This issue will not occur on Mozilla , IE 8 version. it occurs only on IE  browser.

Even if  I set the Session on page_load event but no use. So the thing is Cache ie: the page has been cached stored on Client Browser, so we need to disable the cache.

So Add this line on Master Page inside the Head Tag.

 <meta http-equiv="PRAGMA" value="NO-CACHE"></meta>
<meta content="Mon, 01 Jan 1990 12:00:00 GMT" http-equiv="Expires"></meta>



 
 

uploading text and numeric data from an excel file shows NULL Value

Posted by Venkat | Labels: , ,

Good Morning to everyone

I was working with one of the project , where i had the task of uploading excel ie: Read the Excel data to Dataset ie: from DataSet I am going to store the each field value to DB, so the excel sheet may contain numbers ,or string ,.. by default the Excel sheet  accept  the data based on the first rows of excel sheet.

If the first row and first column will be string - so further the whole first rows and first columns accept strings, if there is any Numeric found  on the first rows and first columns it consider as NULL ie: Empty value , as the same for Numeric also so it may also contain alphanumeric on some cells.

So while we read the Excel sheet  these problems are arise. then we tried to select all cell ie: full excel sheet -> Right Click on the Excel sheet - > format Cells - > Choose String - > click ok .Then I upload this Excel sheet to Read the Data.

Why we change the Format cell  to String means if we set it as string it will accept as both numeric , strings , or alphanumeric - so i am going end it up by doing this.

But the problem arises again - it works that time correctly after few day the same problem occurs, then i do some research or googled and came up with a solution :

The short answer is "IMEX=1" 

You have to apply this on Connection String

To connect to an excel file within ADO.NET use the "System.Data.OleDb" provider  a connection string similar to:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Sample.xls";Persist Security Info=False;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1" 

 Thanks for All. 

 

Invalid postback or callback argument.

Posted by Venkat | Labels:

I came across the post on Forums ie:

Invalid postback or callback argument.  Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation

To Solve this issue Make sure that you are using IsPostback on the Page_Load() event of that page.


 page_Load() event
If (!IsPostBack)
{
// bind the data
}

"The state information is invalid for this page and might be corrupted" With ASP.NET AJAX

Posted by Venkat | Labels:

If you got this error while you working with Asp.Net AJAX.

This seems to be caused by Firefox's methods for saving session information in its cache. There is many way to solve this problem it’s depending on how extensive you want to disable the cache. In my case, I just wanted to do it on one page, so at the top of Page_Load I added:

Response.Cache.SetNoStore();


Set the page Declaration with

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Page.aspx.cs" Inherits="Main" Title=My Home" EnableViewStateMac ="false" EnableSessionState="True" EnableEventValidation ="false" ValidateRequest ="false" ViewStateEncryptionMode ="Never" %>
You can also add with web.config file

<pages validaterequest="false" enableeventvalidation="false" viewstateencryptionmode="Never">
</pages>

Specified string is not in the form required for an e-mail address

Posted by Venkat | Labels:

This error cause while you are working with .net1.1.1 ie" Sytstem.Web.Mail; if we send the email to multiple person we use like this

string toemail = "xxxxx@yahoo.com;yyyyyy@gmail.com;zzzzzz@hotmail.com;";

so this works there because we used semicolon to separate the emailID

But in .net 2.0 System.Net.Mail

if we use the same way (ie: using semicolon to differentiate the emailID) it will cause to give this error.

"Specified string is not in the form required for an e-mail address"

so the modified string

string toemail = "xxxxx@yahoo.com,yyyyyy@gmail.com,zzzzzz@hotmail.com";

Sys is Undefined

Posted by Venkat | Labels: ,

When i add ajaxtoolkit.dll file to bin folder of my new project that has been created in .net 2005 or .net 2.0 so when i place the ajax controls on my page and written some code on running the project it shows no error but code is not working on status bar i have see Error on this page

When i click the error icon it shows Sys is undefined

so the solution is you have to modify the web.config file like this.

1) Below <Configuraion> tag add this


<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>


2) Below <system.web> add the settings

<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>


3) Then find compilation debug="false" change like this


<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>

4) Then below the compilation settings

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>


5) Then after </system.web> add the settings

<system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>

6) Then add the system.webserver settings

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>


These are the setting you have to modify on your web.config if your are selecting the AJAX - Enabled Websites when you are creating the project so at that time there is no need these setting, these settings are added automatically.

All the best

Could not load file or Assembly

Posted by Venkat | Labels:


Hi, if you got error like this..Could not load file or Assembly for While you adding AjaxToolkit.dll

You have update your ajaxtoolkit from Codeplex.com

Here the link


http://www.codeplex.com/AjaxControlToolkit/Release/ProjectReleases.aspx?ReleaseId=8513

PayOffers.in