Friday, December 2, 2011
Question : 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."
Solution :
In your web.config file, you will find this line.
Just replace this line with below line and all your problem solved.
Please send me your questions to me, if you have any..
Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Email: raj143svmit@gmail.com
Dobazaar (Dubai, UAE)
www.dobazaar.com
Sunday, October 30, 2011
Question : How to use global.asax and do 301 redirect "/Default.aspx" to "/" Root ?
Answer :
Add below code in global.asax, thats it.
void Application_BeginRequest(object sender, EventArgs e)
{
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://induway.com"))
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://induway.com/default.aspx", "http://www.induway.com"));
}
}
Let me know, if you have any query..
Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Email: raj143svmit@gmail.com
Dobazaar (Dubai, UAE)
www.dobazaar.com
Thursday, September 22, 2011
Hello Friends,
This post will explain you how you can create, read and delete the cookies in your webpage using Javascript.
Here is the code to create cookies,
In this below code, you can see, Cookies is Set to Name "RajeshCookie" and value is set to "Rajesh" and
its expire time is set to next month as shown in below code.
//for creating a cookie
<script type="text/javascript">
<!--
var today = new Date();
var nextMonth = new Date(today.getYear(), today.getMonth()+1, today.getDate());
setCookie("RajeshCookie", "Rajesh", nextMonth);
// -->
</script>
Here is the code to read cookies,
//for reading the cookie
<script type="text/javascript">
<!--
var szName = getCookie("RajeshCookie");
// -->
</script>
Here is the code to Delete cookies,
//for deleting the cookie
<script type="text/javascript">
<!--
deleteCookie('RajeshCookie');
// -->
</script>
Let me know, if you have any query..
Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com
Hello Friends,
Sometime, you might have notice that, your hosting server is working fine but your database is not working due to which you
might be getting error on website and you might be loosing visitor and ranking in website..
This post is regarding that only, you can manage this issue by two database.
You can have two database at different server and you can call this in global.asax
first you can make ping to first database everytime and if its working you can call first server database and
if you find any issue or server is not working then you can switch to second server using below code..
Dim connStatus As String
Dim png As New Ping()
Dim pr As PingReply = png.Send("221.256.357.36")
connStatus = pr.Status.ToString()
'--------------------
If connStatus = "Success" Then
If ConnString = "OldConnection" Then
If ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString <> "" Then
ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection1").ConnectionString)
Else
Throw New Exception("Connection String is Empty")
End If
Else
If ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString <> "" Then
ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("oldconnection2").ConnectionString)
Else
Throw New Exception("Connection String is Empty")
End If
End If
Else
If ConnString = "newconnection" Then
If ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString <> "" Then
ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection1").ConnectionString)
Else
Throw New Exception("Connection String is Empty")
End If
Else
If ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString <> "" Then
ConnObj = New SqlConnection(ConfigurationManager.ConnectionStrings("newconnection2").ConnectionString)
Else
Throw New Exception("Connection String is Empty")
End If
End If
End If
Let me know, if you have any query..
Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com
Monday, September 12, 2011
Hello Friends,
This post contains one query, by using that you can make search for any text in your Stored
Procedure Or Triggers,
Here is the query..
Use TempDatabase
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%proc_%'
AND ROUTINE_TYPE='PROCEDURE'
Frist Select the Database by Use prefix,like below
use TempDatabase
Then copy this query in your query browser of SQL server,
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%proc_%'
AND ROUTINE_TYPE='PROCEDURE'
and just press F5, to run this query
Let me know, if you have any query..
Thanks Hope this post will help you, if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer
e-Procurement Technologies Ltd (India)
www.abcprocure.com