Code for Logout button

Posted by Venkat | Labels:

If you are not using master pages then you have to paste this code of all the pages (on load event).


Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

On logout

You have to write

Session.Abandon();
Session.Clear();

Use If condition inside the Gridiview or Datalist

Posted by Venkat | Labels:

Here the Html Code , html was not allowed here so i have conver < - &lt and > - &gt


&lt asp
:HyperLink ID="HyperLink1" Visible=" &lt %# isFilePathEmpty(Eval("filepath")) % &gt " NavigateUrl="~/AddPost.aspx?ForumID=18#" runat="server" &gt
&lt %# Eval("PartNumber") &gt
&lt /asp:HyperLink &gt

then create a method called isFilePathEmpty(string filePath) in the code behind which returns a boolean.

Validation of ViewSate MAC Failed

Posted by Venkat | Labels:

If you are getting this error .

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster

Write the below code..

Update your web.config with following attributes.

pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" enableViewStateMac="false"

PayOffers.in