我已经完成了更改网址,但之后任何链接点击然后发生了异常? [英] I have completed change url but after that any link click then exception occured?

查看:73
本文介绍了我已经完成了更改网址,但之后任何链接点击然后发生了异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%#If(Eval(PlanTitle)=免费, 网站)%>









在全球页面(vb代码)



Imports System.Web.SessionState

Imports System.IO



公共类Global_asax

继承System.Web.HttpApplication



Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

'应用程序启动时触发

End Sub



Sub Session_Start(ByVal发送者为对象,ByVal e As EventArgs)

'会话开始时触发

结束子



Sub Application_BeginRequest(ByVal sender As Object,ByVal e As EventArgs)

'在每个请求开始时触发



Dim physicalPathVar As String = Request.PhysicalPath.ToString()



'Response.Write(physicalPathVar + - 在索引中);

'回报;

如果File.Exists(physicalPathVar)那么

'在这里什么都不做,只需提供文件

'Response.Write(physicalPathVar + - 在其他部分0);

'如果文件不存在那么

ElseIf Not File.Exists(physicalPathVar)那么

'Response.Write(physicalPathVar + - 在其他部分1);

'获取用户请求的URL

Dim sRequestedURL As String = Request.Path

Dim sTa​​rgetURL As String =





如果sRequestedURL.Contains(business /)那么



Dim _location作为Integer = sRequestedURL.LastIndexOf(/)



sRequestedURL = sRequestedURL.Substring(_location + 1)

'检查URL形成良好



'*********** Sonu测试*结束***************

sTargetURL = Me.convertRssURL(sRequestedURL)



否则

'随着更多模块的添加,所以检查这里

'Response.Write(physicalPathVar + - 其他第4部分);

sTargetURL =Default.aspx

结束如果

'Response.Write(physicalPathVar + - Else part 5);

Context.RewritePath(sTargetURL,False)

'Response.Write(physicalPathVar + - Else part 6);

结束如果



End Sub



Sub Application_AuthenticateRequest(ByVal sender As对象,ByVal e As EventArgs)

'尝试验证使用时触发

End Sub



Sub Application_Error(ByVal sender As Object,ByVal e As EventArgs)

'发生错误时触发

结束Sub



Sub Session_End(ByVal sender As Object,ByVal e As EventArgs)

'会话结束时触发

End Sub



Sub Application_End(ByVal sender As Object,ByVal e As EventArgs)

'申请结束时开火

End Sub



公共函数convertRssURL(ByVal URLToProcess As String)As String



Dim finalURL As String =



如果URLToProcess.Length> 0然后



finalURL =〜/ ViewExternalWebSite.aspx?id =+ URLToProcess

Else



finalURL =/

结束如果



返回finalURL
结束功能





结束班级



我的原始网址 - :ViewWebsite.aspx?id = 41

i已完成更改网址

ViewWebsite.aspx?id = 41 to

business / username / 41



但是现在任何其他链接点击这个页面然后异常为什么?

我的网址已被捕获(业务)

<%#If(Eval("PlanTitle") = "Free", "", "Website")%>




In global page(vb code)

Imports System.Web.SessionState
Imports System.IO

Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request

Dim physicalPathVar As String = Request.PhysicalPath.ToString()

'Response.Write(physicalPathVar + " - in Index");
'return;
If File.Exists(physicalPathVar) Then
' Do nothing here, just serve the file
'Response.Write(physicalPathVar + " - in Else part 0");
' If the file does not exist then
ElseIf Not File.Exists(physicalPathVar) Then
'Response.Write(physicalPathVar + " - in Else part 1");
' Get the URL requested by the user
Dim sRequestedURL As String = Request.Path
Dim sTargetURL As String = ""


If sRequestedURL.Contains("business/") Then

Dim _location As Integer = sRequestedURL.LastIndexOf("/")

sRequestedURL = sRequestedURL.Substring(_location + 1)
' check if the URL is well formed

'*********** Sonu testing *end ***************
sTargetURL = Me.convertRssURL(sRequestedURL)

Else
' as more modules are added so will the checks here
'Response.Write(physicalPathVar + " - in Else part 4");
sTargetURL = "Default.aspx"
End If
'Response.Write(physicalPathVar + " - in Else part 5");
Context.RewritePath(sTargetURL, False)
'Response.Write(physicalPathVar + " - in Else part 6");
End If

End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Public Function convertRssURL(ByVal URLToProcess As String) As String

Dim finalURL As String = ""

If URLToProcess.Length > 0 Then

finalURL = "~/ViewExternalWebSite.aspx?id=" + URLToProcess
Else

finalURL = "/"
End If

Return finalURL
End Function


End Class

My original url -: ViewWebsite.aspx?id=41
i have completed change url
ViewWebsite.aspx?id=41 to
business/username/41

But now any other link click in this page then exception why?
My url has been caught (business)

推荐答案

这篇关于我已经完成了更改网址,但之后任何链接点击然后发生了异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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