Asp .net Global.asax文件

编程入门 行业动态 更新时间:2024-10-28 08:18:53
本文介绍了Asp Global.asax文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Global.asax下编写了代码。这里的错误信息是页面没有正确重定向......。我如何重定向到另一页..?PLZ SUGGEST ME ...

I had written the code under the Global.asax. Here the error message was "The page isn't redirecting properly...".HOW CAN I REDIRECT TO ANOTHER PAGE..?PLZ SUGGEST ME ...

void Application_BeginRequest(object sender, EventArgs e) { cmd = new System.Data.SqlClient.SqlCommand("sp_Checkurl", con_obj.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@url", url); da = new System.Data.SqlClient.SqlDataAdapter(cmd); ds = new System.Data.DataSet(); da.Fill(ds); con_obj.Conn_close(); if (ds.Tables[0].Rows.Count > 0) { HttpContext.Current.Response.Redirect(url); Dispose(); } else { HttpContext.Current.Response.Redirect("localhost:51262/Mywebsite/Blankpage.aspx"); Dispose(); } }

推荐答案

而不是 HttpContext.Current.Response.Redirect(url);

尝试写

try writing

Server.Transfer(url)

看看它是否有效。

你好我是桑尼。我们应该把下面唯一一个重定向页面如下 Hi i am sanny.Here we should put the only one redirect page like below if (ds.Tables[0].Rows.Count==0) { HttpContext.Current.Response.Redirect(url); Dispose(); }

if (Request.Url.OriginalString.Contains("handler.aspx?menu_id=")) { Context.RewritePath("~/Handler.aspx"); return; }

它应该是这样的,并且下一个声明的回报不应该实现 问......:)

it should be like this and return for next statement should not be implemented regards...:)

更多推荐

Asp .net Global.asax文件

本文发布于:2023-11-04 10:03:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557628.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   net   Asp   asax   Global

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!