Application_BeginRequest -Global.asax problem

A

Ankit Aneja

I put the code for url rewrite in my Application_BeginRequest on global.ascx
some .aspx pages are in root ,some in folder named admin and some in folder
named user
aspx pages which are in user folder are using this code of url rewrite
project is running completely fine on localhost

but after uploading first page
(http://emailware.net.temporary.domain.name/user/index.aspx) is fine
but as i click
123 Easy-CD Ripper
new page is to be opened using the url rewrite code which is not getting
opened
for debugging
i put line for alert box in Application_BeginRequest
it gives alert box on each page request on local host
but after uploading only on first as i click 123Easy-CD Ripper
it doen't give alert box this time
i.e code in Application_BeginRequest is not getting executed
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

' Fires at the beginning of each request

Response.Write("<script language=jscript>alert('" & "inside appbegin
request" & "')</script>")

Dim Context As HttpContext = HttpContext.Current

Dim oldpath As String = Context.Request.Path.ToLower()

Dim lastpath() As String = Split(oldpath, "/")

Dim laname As String = lastpath.GetValue(lastpath.Length - 2)

Dim token As String = "/category/"

Dim i As Integer = oldpath.IndexOf(token)

Dim len As Integer = token.Length

If i <> -1 Then

Dim j As Integer = oldpath.IndexOf("/index.aspx")

If j <> -1 Then

Dim strName As String = oldpath.Substring(i + len, j - (i + len))

Dim id As Integer

id = database.getId(laname)

Dim navpath() As String = database.navigation(id)

Dim Newpath As String = oldpath.Replace(token & strName & "/index.aspx",
"/user/home.aspx?action=1&cid=" & id)

Context.RewritePath(Newpath)

End If

End If

token = "-"

i = oldpath.IndexOf(token)

Dim proIndex As Integer = oldpath.IndexOf("/category")

len = token.Length

If i <> -1 Then

Dim j As Integer = oldpath.IndexOf(".aspx")

If j <> -1 Then

Dim strLid As String = oldpath.Substring(i + len, j - (i + len))

Dim strold As String = oldpath.Substring(proIndex, i - proIndex) & "-"

Dim NewLidpath As String

NewLidpath = oldpath.Replace(strold & strLid & ".aspx",
"/user/moreinfo.aspx?lid=" & strLid)

Context.RewritePath(NewLidpath)

End If

End If

token = "/type/"

i = oldpath.IndexOf(token)

len = token.Length

If i <> -1 Then

Dim j As Integer = oldpath.IndexOf(".aspx")

If j <> -1 Then

Dim strName As String = oldpath.Substring(i + len, j - (i + len))

Dim typepath As String

typepath = oldpath.Replace(token & strName & ".aspx",
"/user/type.aspx?ptype=" & strName)

Context.RewritePath(typepath)

End If

End If

End Sub
 
S

Steven Cheng[MSFT]

Hi Ankit,

Welcome to ASPNET newsgroup.
As for the UrlRewriting problem you mentioned, I'm thinking whether it's a
code logic related or environment specific issue. Have you tried upload a
more simpler global.asax file(with the very simple rewrite code logic in
the begin_request event) to see whether it can get work on that site?

Also, if the global.asax's events didn't get fired, is there any certain
error occuring? Anyway, I think we may start troubleshoot from simple code.

If there're any other findings, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)






--------------------
| From: "Ankit Aneja" <[email protected]>
| References: <[email protected]>
| Subject: Re: Application_BeginRequest -Global.asax problem
| Date: Thu, 7 Jul 2005 13:01:59 +0530
| Lines: 130
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com 61.16.176.148
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:110822
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Now i removed user folder and all pages are on root directory
| new link is
| http://emailware.net.temporary.domain.name/index.aspx
|
|
| | > I put the code for url rewrite in my Application_BeginRequest on
| global.ascx
| > some .aspx pages are in root ,some in folder named admin and some in
| folder
| > named user
| > aspx pages which are in user folder are using this code of url rewrite
| > project is running completely fine on localhost
| >
| > but after uploading first page
| > (http://emailware.net.temporary.domain.name/user/index.aspx) is fine
| > but as i click
| > 123 Easy-CD Ripper
| > new page is to be opened using the url rewrite code which is not getting
| > opened
| > for debugging
| > i put line for alert box in Application_BeginRequest
| > it gives alert box on each page request on local host
| > but after uploading only on first as i click 123Easy-CD Ripper
| > it doen't give alert box this time
| > i.e code in Application_BeginRequest is not getting executed
| > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
| >
| > ' Fires at the beginning of each request
| >
| > Response.Write("<script language=jscript>alert('" & "inside appbegin
| > request" & "')</script>")
| >
| > Dim Context As HttpContext = HttpContext.Current
| >
| > Dim oldpath As String = Context.Request.Path.ToLower()
| >
| > Dim lastpath() As String = Split(oldpath, "/")
| >
| > Dim laname As String = lastpath.GetValue(lastpath.Length - 2)
| >
| > Dim token As String = "/category/"
| >
| > Dim i As Integer = oldpath.IndexOf(token)
| >
| > Dim len As Integer = token.Length
| >
| > If i <> -1 Then
| >
| > Dim j As Integer = oldpath.IndexOf("/index.aspx")
| >
| > If j <> -1 Then
| >
| > Dim strName As String = oldpath.Substring(i + len, j - (i + len))
| >
| > Dim id As Integer
| >
| > id = database.getId(laname)
| >
| > Dim navpath() As String = database.navigation(id)
| >
| > Dim Newpath As String = oldpath.Replace(token & strName & "/index.aspx",
| > "/user/home.aspx?action=1&cid=" & id)
| >
| > Context.RewritePath(Newpath)
| >
| > End If
| >
| > End If
| >
| > token = "-"
| >
| > i = oldpath.IndexOf(token)
| >
| > Dim proIndex As Integer = oldpath.IndexOf("/category")
| >
| > len = token.Length
| >
| > If i <> -1 Then
| >
| > Dim j As Integer = oldpath.IndexOf(".aspx")
| >
| > If j <> -1 Then
| >
| > Dim strLid As String = oldpath.Substring(i + len, j - (i + len))
| >
| > Dim strold As String = oldpath.Substring(proIndex, i - proIndex) & "-"
| >
| > Dim NewLidpath As String
| >
| > NewLidpath = oldpath.Replace(strold & strLid & ".aspx",
| > "/user/moreinfo.aspx?lid=" & strLid)
| >
| > Context.RewritePath(NewLidpath)
| >
| > End If
| >
| > End If
| >
| > token = "/type/"
| >
| > i = oldpath.IndexOf(token)
| >
| > len = token.Length
| >
| > If i <> -1 Then
| >
| > Dim j As Integer = oldpath.IndexOf(".aspx")
| >
| > If j <> -1 Then
| >
| > Dim strName As String = oldpath.Substring(i + len, j - (i + len))
| >
| > Dim typepath As String
| >
| > typepath = oldpath.Replace(token & strName & ".aspx",
| > "/user/type.aspx?ptype=" & strName)
| >
| > Context.RewritePath(typepath)
| >
| > End If
| >
| > End If
| >
| > End Sub
| >
| >
|
|
|
 
A

Ankit Aneja

i put the code for alert box in first line of Application_BeginRequest
and it is getting fired correctly on local host for all pages
but after uploading it get fired only for pages not involving url rewrite
as in applicaion_beginrequest i write the code for correct url from fake
url
i am using "<a href ="fake url"> " is it like that i have to use some asp
control
 
A

Ankit Aneja

For fake url it is even not going to Application_BeginRequest
then how can i test it using simple url
But on local host it is running correctly
can this be due to global.asax file is not at correct place
 
S

Steven Cheng[MSFT]

Hi Ankit,

Since you mentioned that
=======
For fake url it is even not going to Application_BeginRequest
======

I think the problem could be due to the IIS virtual dir's extension mapping
for your fake url. What's your fake url's extension , just like *.xxx .

for those ASP.NET's buildin document files (such as *.aspx , *.ascx,
*.asmx...) there has extension mapping in the IIS's virtual dir
configuation which maps all the asp.net expected documents to the
aspnet_isapi.dll. So for your custom fake url, since we need to router it
to the asp.net runtime, we also need to add a mapping entry for it in the
IIS's virtual dir setting.

For detail info, you can refer to the following tech article(just the
section describing configuring the ISAPI mapping):

http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/httphandler.
mspx

If there're anything unclear, please feel free to let me know.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Ankit Aneja" <[email protected]>
| References: <[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: Application_BeginRequest -Global.asax problem
| Date: Thu, 7 Jul 2005 17:52:55 +0530
| Lines: 189
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com 61.16.176.148
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:110897
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| For fake url it is even not going to Application_BeginRequest
| then how can i test it using simple url
| But on local host it is running correctly
| can this be due to global.asax file is not at correct place
| | > Hi Ankit,
| >
| > Welcome to ASPNET newsgroup.
| > As for the UrlRewriting problem you mentioned, I'm thinking whether
it's a
| > code logic related or environment specific issue. Have you tried upload
a
| > more simpler global.asax file(with the very simple rewrite code logic in
| > the begin_request event) to see whether it can get work on that site?
| >
| > Also, if the global.asax's events didn't get fired, is there any certain
| > error occuring? Anyway, I think we may start troubleshoot from simple
| code.
| >
| > If there're any other findings, please feel free to post here.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| > --------------------
| > | From: "Ankit Aneja" <[email protected]>
| > | References: <[email protected]>
| > | Subject: Re: Application_BeginRequest -Global.asax problem
| > | Date: Thu, 7 Jul 2005 13:01:59 +0530
| > | Lines: 130
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com
61.16.176.148
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:110822
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Now i removed user folder and all pages are on root directory
| > | new link is
| > | http://emailware.net.temporary.domain.name/index.aspx
| > |
| > |
| > | | > | > I put the code for url rewrite in my Application_BeginRequest on
| > | global.ascx
| > | > some .aspx pages are in root ,some in folder named admin and some
in
| > | folder
| > | > named user
| > | > aspx pages which are in user folder are using this code of url
rewrite
| > | > project is running completely fine on localhost
| > | >
| > | > but after uploading first page
| > | > (http://emailware.net.temporary.domain.name/user/index.aspx) is fine
| > | > but as i click
| > | > 123 Easy-CD Ripper
| > | > new page is to be opened using the url rewrite code which is not
| getting
| > | > opened
| > | > for debugging
| > | > i put line for alert box in Application_BeginRequest
| > | > it gives alert box on each page request on local host
| > | > but after uploading only on first as i click 123Easy-CD Ripper
| > | > it doen't give alert box this time
| > | > i.e code in Application_BeginRequest is not getting executed
| > | > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
| > EventArgs)
| > | >
| > | > ' Fires at the beginning of each request
| > | >
| > | > Response.Write("<script language=jscript>alert('" & "inside appbegin
| > | > request" & "')</script>")
| > | >
| > | > Dim Context As HttpContext = HttpContext.Current
| > | >
| > | > Dim oldpath As String = Context.Request.Path.ToLower()
| > | >
| > | > Dim lastpath() As String = Split(oldpath, "/")
| > | >
| > | > Dim laname As String = lastpath.GetValue(lastpath.Length - 2)
| > | >
| > | > Dim token As String = "/category/"
| > | >
| > | > Dim i As Integer = oldpath.IndexOf(token)
| > | >
| > | > Dim len As Integer = token.Length
| > | >
| > | > If i <> -1 Then
| > | >
| > | > Dim j As Integer = oldpath.IndexOf("/index.aspx")
| > | >
| > | > If j <> -1 Then
| > | >
| > | > Dim strName As String = oldpath.Substring(i + len, j - (i + len))
| > | >
| > | > Dim id As Integer
| > | >
| > | > id = database.getId(laname)
| > | >
| > | > Dim navpath() As String = database.navigation(id)
| > | >
| > | > Dim Newpath As String = oldpath.Replace(token & strName &
| "/index.aspx",
| > | > "/user/home.aspx?action=1&cid=" & id)
| > | >
| > | > Context.RewritePath(Newpath)
| > | >
| > | > End If
| > | >
| > | > End If
| > | >
| > | > token = "-"
| > | >
| > | > i = oldpath.IndexOf(token)
| > | >
| > | > Dim proIndex As Integer = oldpath.IndexOf("/category")
| > | >
| > | > len = token.Length
| > | >
| > | > If i <> -1 Then
| > | >
| > | > Dim j As Integer = oldpath.IndexOf(".aspx")
| > | >
| > | > If j <> -1 Then
| > | >
| > | > Dim strLid As String = oldpath.Substring(i + len, j - (i + len))
| > | >
| > | > Dim strold As String = oldpath.Substring(proIndex, i - proIndex) &
"-"
| > | >
| > | > Dim NewLidpath As String
| > | >
| > | > NewLidpath = oldpath.Replace(strold & strLid & ".aspx",
| > | > "/user/moreinfo.aspx?lid=" & strLid)
| > | >
| > | > Context.RewritePath(NewLidpath)
| > | >
| > | > End If
| > | >
| > | > End If
| > | >
| > | > token = "/type/"
| > | >
| > | > i = oldpath.IndexOf(token)
| > | >
| > | > len = token.Length
| > | >
| > | > If i <> -1 Then
| > | >
| > | > Dim j As Integer = oldpath.IndexOf(".aspx")
| > | >
| > | > If j <> -1 Then
| > | >
| > | > Dim strName As String = oldpath.Substring(i + len, j - (i + len))
| > | >
| > | > Dim typepath As String
| > | >
| > | > typepath = oldpath.Replace(token & strName & ".aspx",
| > | > "/user/type.aspx?ptype=" & strName)
| > | >
| > | > Context.RewritePath(typepath)
| > | >
| > | > End If
| > | >
| > | > End If
| > | >
| > | > End Sub
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
 
S

Steven Cheng[MSFT]

Cool! Have a nice weekend!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Ankit Aneja" <[email protected]>
| References: <[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Application_BeginRequest -Global.asax problem
| Date: Fri, 8 Jul 2005 12:25:27 +0530
| Lines: 266
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com 61.16.176.148
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:111070
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks that was the exact problem
| it gets solved now
| | > Hi Ankit,
| >
| > Since you mentioned that
| > =======
| > For fake url it is even not going to Application_BeginRequest
| > ======
| >
| > I think the problem could be due to the IIS virtual dir's extension
| mapping
| > for your fake url. What's your fake url's extension , just like *.xxx .
| >
| > for those ASP.NET's buildin document files (such as *.aspx , *.ascx,
| > *.asmx...) there has extension mapping in the IIS's virtual dir
| > configuation which maps all the asp.net expected documents to the
| > aspnet_isapi.dll. So for your custom fake url, since we need to router
| it
| > to the asp.net runtime, we also need to add a mapping entry for it in
the
| > IIS's virtual dir setting.
| >
| > For detail info, you can refer to the following tech article(just the
| > section describing configuring the ISAPI mapping):
| >
| >
|
http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/httphandler.
| > mspx
| >
| > If there're anything unclear, please feel free to let me know.
| >
| > Thanks & Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| > --------------------
| > | From: "Ankit Aneja" <[email protected]>
| > | References: <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > | Subject: Re: Application_BeginRequest -Global.asax problem
| > | Date: Thu, 7 Jul 2005 17:52:55 +0530
| > | Lines: 189
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com
61.16.176.148
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:110897
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | For fake url it is even not going to Application_BeginRequest
| > | then how can i test it using simple url
| > | But on local host it is running correctly
| > | can this be due to global.asax file is not at correct place
| > | | > | > Hi Ankit,
| > | >
| > | > Welcome to ASPNET newsgroup.
| > | > As for the UrlRewriting problem you mentioned, I'm thinking whether
| > it's a
| > | > code logic related or environment specific issue. Have you tried
| upload
| > a
| > | > more simpler global.asax file(with the very simple rewrite code
logic
| in
| > | > the begin_request event) to see whether it can get work on that
site?
| > | >
| > | > Also, if the global.asax's events didn't get fired, is there any
| certain
| > | > error occuring? Anyway, I think we may start troubleshoot from
simple
| > | code.
| > | >
| > | > If there're any other findings, please feel free to post here.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "Ankit Aneja" <[email protected]>
| > | > | References: <[email protected]>
| > | > | Subject: Re: Application_BeginRequest -Global.asax problem
| > | > | Date: Thu, 7 Jul 2005 13:01:59 +0530
| > | > | Lines: 130
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| > | > | Message-ID: <#[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindia.com
| > 61.16.176.148
| > | > | Path:
| TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:110822
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | Now i removed user folder and all pages are on root directory
| > | > | new link is
| > | > | http://emailware.net.temporary.domain.name/index.aspx
| > | > |
| > | > |
| > | > | | > | > | > I put the code for url rewrite in my Application_BeginRequest on
| > | > | global.ascx
| > | > | > some .aspx pages are in root ,some in folder named admin and
some
| > in
| > | > | folder
| > | > | > named user
| > | > | > aspx pages which are in user folder are using this code of url
| > rewrite
| > | > | > project is running completely fine on localhost
| > | > | >
| > | > | > but after uploading first page
| > | > | > (http://emailware.net.temporary.domain.name/user/index.aspx) is
| fine
| > | > | > but as i click
| > | > | > 123 Easy-CD Ripper
| > | > | > new page is to be opened using the url rewrite code which is not
| > | getting
| > | > | > opened
| > | > | > for debugging
| > | > | > i put line for alert box in Application_BeginRequest
| > | > | > it gives alert box on each page request on local host
| > | > | > but after uploading only on first as i click 123Easy-CD Ripper
| > | > | > it doen't give alert box this time
| > | > | > i.e code in Application_BeginRequest is not getting executed
| > | > | > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
| > | > EventArgs)
| > | > | >
| > | > | > ' Fires at the beginning of each request
| > | > | >
| > | > | > Response.Write("<script language=jscript>alert('" & "inside
| appbegin
| > | > | > request" & "')</script>")
| > | > | >
| > | > | > Dim Context As HttpContext = HttpContext.Current
| > | > | >
| > | > | > Dim oldpath As String = Context.Request.Path.ToLower()
| > | > | >
| > | > | > Dim lastpath() As String = Split(oldpath, "/")
| > | > | >
| > | > | > Dim laname As String = lastpath.GetValue(lastpath.Length - 2)
| > | > | >
| > | > | > Dim token As String = "/category/"
| > | > | >
| > | > | > Dim i As Integer = oldpath.IndexOf(token)
| > | > | >
| > | > | > Dim len As Integer = token.Length
| > | > | >
| > | > | > If i <> -1 Then
| > | > | >
| > | > | > Dim j As Integer = oldpath.IndexOf("/index.aspx")
| > | > | >
| > | > | > If j <> -1 Then
| > | > | >
| > | > | > Dim strName As String = oldpath.Substring(i + len, j - (i +
len))
| > | > | >
| > | > | > Dim id As Integer
| > | > | >
| > | > | > id = database.getId(laname)
| > | > | >
| > | > | > Dim navpath() As String = database.navigation(id)
| > | > | >
| > | > | > Dim Newpath As String = oldpath.Replace(token & strName &
| > | "/index.aspx",
| > | > | > "/user/home.aspx?action=1&cid=" & id)
| > | > | >
| > | > | > Context.RewritePath(Newpath)
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > token = "-"
| > | > | >
| > | > | > i = oldpath.IndexOf(token)
| > | > | >
| > | > | > Dim proIndex As Integer = oldpath.IndexOf("/category")
| > | > | >
| > | > | > len = token.Length
| > | > | >
| > | > | > If i <> -1 Then
| > | > | >
| > | > | > Dim j As Integer = oldpath.IndexOf(".aspx")
| > | > | >
| > | > | > If j <> -1 Then
| > | > | >
| > | > | > Dim strLid As String = oldpath.Substring(i + len, j - (i + len))
| > | > | >
| > | > | > Dim strold As String = oldpath.Substring(proIndex, i -
proIndex) &
| > "-"
| > | > | >
| > | > | > Dim NewLidpath As String
| > | > | >
| > | > | > NewLidpath = oldpath.Replace(strold & strLid & ".aspx",
| > | > | > "/user/moreinfo.aspx?lid=" & strLid)
| > | > | >
| > | > | > Context.RewritePath(NewLidpath)
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > token = "/type/"
| > | > | >
| > | > | > i = oldpath.IndexOf(token)
| > | > | >
| > | > | > len = token.Length
| > | > | >
| > | > | > If i <> -1 Then
| > | > | >
| > | > | > Dim j As Integer = oldpath.IndexOf(".aspx")
| > | > | >
| > | > | > If j <> -1 Then
| > | > | >
| > | > | > Dim strName As String = oldpath.Substring(i + len, j - (i +
len))
| > | > | >
| > | > | > Dim typepath As String
| > | > | >
| > | > | > typepath = oldpath.Replace(token & strName & ".aspx",
| > | > | > "/user/type.aspx?ptype=" & strName)
| > | > | >
| > | > | > Context.RewritePath(typepath)
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > End If
| > | > | >
| > | > | > End Sub
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top