asp.net中的URL重写概念 [英] URL Rewritting concept in asp.net

查看:67
本文介绍了asp.net中的URL重写概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

任何人都可以帮助我如何在asp.net按钮单击中使用url ReWritting概念,我在应用程序开始使用global.asax之前就已经检查过它的工作原理,但是我已经应用按钮单击事件的相同概念却得到了错误,我不知道原因请帮助我,

Hi All,

Any one can help me how to use url ReWritting concept in asp.net button click, i have checked before application start using global.asax its working fine but the same concept i have applied button click event its getting error i don''t know the reason please help me ,

protected void BTNTEST_Click(object sender, EventArgs e)
{
    string CurrentURL_Path = Request.Path.ToLower();
    if (CurrentURL_Path.StartsWith("/urlrewriting/"))
    {
        CurrentURL_Path = CurrentURL_Path.Trim();
        //string NewsID = "21";// CurrentURL_Path.Substring(CurrentURL_Path.IndexOf("/"));
        HttpContext MyContext = HttpContext.Current;
        MyContext.RewritePath("/urlrewriting/test.aspx?News=21");

    }

}




它显示错误,如





its shows error like ,


Server Error in '/urlrewriting' 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.





如何解决该问题?





how to solve the issue ?

推荐答案

您好,

请浏览以下有关同一问题的文章.看看它是否可以帮助您解决问题:
http://aspdotnetmatters.blogspot.com/2011/10/validation-of- viewstate-mac-failed.html [ ^ ]
http://blogs.msdn. com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx [
Hello,

Please go through below article on the same issue. See if it helps you in resolving the issue:
http://aspdotnetmatters.blogspot.com/2011/10/validation-of-viewstate-mac-failed.html[^]
http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx[^]


这篇关于asp.net中的URL重写概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆