Web.config Transformation Syntax for Web Application Project Deployment
http://msdn.microsoft.com/en-us/library/dd465326(VS.100).aspx
automate the process of changing (transforming) Web.config files when they are deployed. For each environment that you want to deploy to, you create a transform file that specifies only the differences between the original Web.config file and the deployed Web.config file for that environment.
Thursday, June 10, 2010
How to regenerate designer.cs in asp.net
Delete content in .designer.cs, and save
Go to html view, modify a little bit, (Such as add a space), then save
.designer.cs should be OK then.
Go to html view, modify a little bit, (Such as add a space), then save
.designer.cs should be OK then.
Thursday, April 29, 2010
How to fix Invalid viewstate and Validation of viewstate MAC failed in asp.net?
There are couple errors in asp.net related to viewstate
1. System.Web.HttpException: The client disconnected. ---> System.Web.UI.ViewStateException: Invalid viewstate.
2. System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. ---> System.Web.UI.ViewStateException: Invalid viewstate.
How to fix?
1. Check Application Pool Recycling IIS setting
The fix in this case is to adjust the settings on the application pools so that recycling is less likely to occur at peak periods.
2. put machineKey section into your web.config (http://www.aspnetresources.com/tools/keycreator.aspx)
Such as:
<machineKey
validationKey="80FE3D40B4CDD7FBC1DC32FA0DC87C83586B651214A19F4BC140970DEAE7F99A6B24D2323DB2088E472194BF14CB996062B41F9C2D3A4D821091AA53282F55D5"
decryptionKey="DA085C28238653E0C85994B40AB4208236E0E814BF698F9C202A80901C00F613"
validation="SHA1"
decryption="AES"
/>
References:
1. Intermittent Invalid Viewstate Error in ASP.NET Web pages
http://support.microsoft.com/default.aspx?scid=kb;en-us;555353&sd=rss&spid=6351
2.ASP.NET state management: viewstate
http://www.aspnetresources.com/articles/ViewState.aspx#
1. System.Web.HttpException: The client disconnected. ---> System.Web.UI.ViewStateException: Invalid viewstate.
2. System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. ---> System.Web.UI.ViewStateException: Invalid viewstate.
How to fix?
1. Check Application Pool Recycling IIS setting
The fix in this case is to adjust the settings on the application pools so that recycling is less likely to occur at peak periods.
2. put machineKey section into your web.config (http://www.aspnetresources.com/tools/keycreator.aspx)
Such as:
<machineKey
validationKey="80FE3D40B4CDD7FBC1DC32FA0DC87C83586B651214A19F4BC140970DEAE7F99A6B24D2323DB2088E472194BF14CB996062B41F9C2D3A4D821091AA53282F55D5"
decryptionKey="DA085C28238653E0C85994B40AB4208236E0E814BF698F9C202A80901C00F613"
validation="SHA1"
decryption="AES"
/>
References:
1. Intermittent Invalid Viewstate Error in ASP.NET Web pages
http://support.microsoft.com/default.aspx?scid=kb;en-us;555353&sd=rss&spid=6351
2.ASP.NET state management: viewstate
http://www.aspnetresources.com/articles/ViewState.aspx#
Monday, April 26, 2010
How to handle 404 error in ASP.NET
1. Add following section in web.config
<customErrors mode="On">
<error statusCode="404" redirect="~/error404.aspx" />
</customErrors>
2. Get wrong page from query string
string from = Request.QueryString["aspxerrorpath"];
http://rayaspnet.blogspot.ca/2012/08/handling-exceptions-and-404-errors-in.html
<customErrors mode="On">
<error statusCode="404" redirect="~/error404.aspx" />
</customErrors>
2. Get wrong page from query string
string from = Request.QueryString["aspxerrorpath"];
http://rayaspnet.blogspot.ca/2012/08/handling-exceptions-and-404-errors-in.html
Wednesday, April 21, 2010
Validators and Javascript in asp.net
ASP.NET Validation in Depth
http://msdn.microsoft.com/en-us/library/aa479045.aspx
http://msdn.microsoft.com/en-us/library/aa479045.aspx
Subscribe to:
Posts (Atom)