473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application_BeginRequest -Global.asax problem

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
7 5204
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1438
by: Daniel | last post by:
in Application_BeginRequest how do i cancel the request and send back a message?
1
1730
by: Amil | last post by:
I use a LinkButton in a DataList. I want to set the CommandName and CommandArgument for the LinkButton. Then I want to, before the postback, examine them during Application_BeginRequest to...
3
18314
by: Paul Daly (MCP) | last post by:
I'm trying to write a log file that captures the referring url if the request is a new session, and captures a querystring value if the user is browsing between pages on the website. When using...
1
1634
by: Franck | last post by:
Hi, is it possible to catch called WebMethods name and params in the Application_BeginRequest ? Thks for help
0
255
by: Ana Santana | last post by:
Hi, I am implementing a couple of webservices (all in the same web project) that will access several backoffice systems to get and update different types of information. All the methods in the...
0
1392
by: Rahul | last post by:
Earlier this evening i posted a question that my debug point is hit several times, But after I published the application. I could significantly see less round trip per request for Application_Begin...
3
8029
by: Mike Owen | last post by:
Hi, I have set up a new web site application in VS 2005, and have created a couple of pages which seem to run ok. I then manually added a file called Global.asax.vb, within a folder that I...
19
3559
by: Mark Rae | last post by:
Hi, Is it possible to have programmatic access to the Page object in Application_BeginRequest, or is it too early in the lifecycle...? E.g. to be able to change a page's MasterPage...
2
2195
by: Nemisis | last post by:
Hi everyone, This is the first real .net web application that i have begun to write and i was wondering whether it is ok, to write to the eventlog in the Application_BeginRequest event within...
7
2562
by: Joe | last post by:
I'm trying to use the Application_BeginRequest to re-write the path but it doesn't work on the published site when a non-existing URL is called. This does work fine in my dev environment. For...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.