By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Application_BeginRequest -Global.asax problem

P: n/a
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.domai...ser/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
Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Now i removed user folder and all pages are on root directory
new link is
http://emailware.net.temporary.domain.name/index.aspx
"Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
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.domai...ser/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

Nov 19 '05 #2

P: n/a
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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
| 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| 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!TK2MSFT NGP12.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
|
|
| "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| news:e1**************@TK2MSFTNGP10.phx.gbl...
| > 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.domai...ser/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
| >
| >
|
|
|

Nov 19 '05 #3

P: n/a
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

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Fq*************@TK2MSFTNGXA01.phx.gbl...
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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
| 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| 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!TK2MSFT NGP12.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
|
|
| "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| news:e1**************@TK2MSFTNGP10.phx.gbl...
| > 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.domai...ser/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
| >
| >
|
|
|

Nov 19 '05 #4

P: n/a
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
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Fq*************@TK2MSFTNGXA01.phx.gbl...
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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
| 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| 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!TK2MSFT NGP12.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
|
|
| "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| news:e1**************@TK2MSFTNGP10.phx.gbl...
| > 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.domai...ser/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
| >
| >
|
|
|

Nov 19 '05 #5

P: n/a
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/ms...et/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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
<#H**************@TK2MSFTNGP12.phx.gbl>
<Fq*************@TK2MSFTNGXA01.phx.gbl>
| 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: <Oz**************@TK2MSFTNGP14.phx.gbl>
| 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!TK2MSFT NGP14.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
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Fq*************@TK2MSFTNGXA01.phx.gbl...
| > 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" <ef*****@newsgroups.nospam>
| > | References: <e1**************@TK2MSFTNGP10.phx.gbl>
| > | 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| > | 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!TK2MSFT NGP12.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
| > |
| > |
| > | "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| > | news:e1**************@TK2MSFTNGP10.phx.gbl...
| > | > 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.domai...ser/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
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #6

P: n/a
Thanks that was the exact problem
it gets solved now
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:L3*************@TK2MSFTNGXA01.phx.gbl...
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/ms...et/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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
<#H**************@TK2MSFTNGP12.phx.gbl>
<Fq*************@TK2MSFTNGXA01.phx.gbl>
| 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: <Oz**************@TK2MSFTNGP14.phx.gbl>
| 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!TK2MSFT NGP14.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
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Fq*************@TK2MSFTNGXA01.phx.gbl...
| > 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" <ef*****@newsgroups.nospam>
| > | References: <e1**************@TK2MSFTNGP10.phx.gbl>
| > | 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| > | 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!TK2MSFT NGP12.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
| > |
| > |
| > | "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| > | news:e1**************@TK2MSFTNGP10.phx.gbl...
| > | > 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.domai...ser/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
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #7

P: n/a
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" <ef*****@newsgroups.nospam>
| References: <e1**************@TK2MSFTNGP10.phx.gbl>
<#H**************@TK2MSFTNGP12.phx.gbl>
<Fq*************@TK2MSFTNGXA01.phx.gbl>
<Oz**************@TK2MSFTNGP14.phx.gbl>
<L3*************@TK2MSFTNGXA01.phx.gbl>
| 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: <ef**************@TK2MSFTNGP14.phx.gbl>
| 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!TK2MSFT NGP14.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
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:L3*************@TK2MSFTNGXA01.phx.gbl...
| > 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/ms...et/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" <ef*****@newsgroups.nospam>
| > | References: <e1**************@TK2MSFTNGP10.phx.gbl>
| > <#H**************@TK2MSFTNGP12.phx.gbl>
| > <Fq*************@TK2MSFTNGXA01.phx.gbl>
| > | 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: <Oz**************@TK2MSFTNGP14.phx.gbl>
| > | 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!TK2MSFT NGP14.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
| > | "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| > | news:Fq*************@TK2MSFTNGXA01.phx.gbl...
| > | > 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" <ef*****@newsgroups.nospam>
| > | > | References: <e1**************@TK2MSFTNGP10.phx.gbl>
| > | > | 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: <#H**************@TK2MSFTNGP12.phx.gbl>
| > | > | 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!TK2MSFT NGP12.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
| > | > |
| > | > |
| > | > | "Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
| > | > | news:e1**************@TK2MSFTNGP10.phx.gbl...
| > | > | > 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.domai...ser/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
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.