Search This Blog

Wednesday, July 20, 2016

SQL SERVER – Clear Dropdown List of Recent Connection from SQL Server Management Studio








For SQL 2005, delete the file:

C:\DocumentsSettings\<USER>\ApplicationData\Microsoft\MicrosoftSQL Server\90\Tools\Shell\mru.dat

For SQL Server 2008, delete the file::

C:\Documents and Settings\<user>\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\mru.dat
C:\Documents and Settings\[user]\Application Data\Microsoft\Microsoft SQL Server\100\Tools\ShellSEM\mru.dat




Resolving view state message authentication code (MAC) errors

Server Error in '/' Application.

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.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: 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.
Source Error: [No relevant source lines]
Source File: ... Line: 0
Stack Trace:

[ViewStateException: Invalid viewstate.
Client IP: ::1
Port: 40653
Referer: http://localhost:40643/MyPage.aspx
Path: /MyPage.aspx
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
ViewState: ...]

[HttpException (0x80004005): 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.

See http://go.microsoft.com/fwlink/?LinkID=314055 for more information.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +190
System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +46
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +861
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose) +51
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +67
System.Web.UI.HiddenFieldPageStatePersister.Load() +444
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +368
System.Web.UI.Page.LoadAllState() +109
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7959
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +429
System.Web.UI.Page.ProcessRequest() +125
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +48
System.Web.UI.Page.ProcessRequest(HttpContext context) +234
ASP.mypage_aspx.ProcessRequest(HttpContext context) in ...:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1300
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +140

Resolve this issue you can add a <machineKey> element, in the Web.config file. The <machineKey> element is only valid in the Web.config file at the root of your application and is not valid at the subfolder level.

<configuration>
  <system.web>
    <machineKey ... />  (add below machineKey in system.web section)
  </system.web>
</configuration>

<machineKey
validationKey="20A1D0BF6A9C13FC54FAFAE5534D586F78A50005223F08C0C8AD0704CCF27C29E6F41C30FA03D9E418F7EBB38BFDAC698545C39200C39A622BE22EBC6C10BEE8"
decryptionKey="CD0F6DC238FD884B009B3C5E3163726F58C4D51FE82908E9F1504BF50D95075D"
validation="SHA1" decryption="AES"/>