473,756 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application_Beg inRequest -Global.asax problem

I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
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_Beg inRequest is not getting executed
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)

' Fires at the beginning of each request

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

Dim Context As HttpContext = HttpContext.Cur rent

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

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

Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))

Dim id As Integer

id = database.getId( laname)

Dim navpath() As String = database.naviga tion(id)

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

Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))

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

Dim NewLidpath As String

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

Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))

Dim typepath As String

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

Context.Rewrite Path(typepath)

End If

End If

End Sub
Nov 19 '05 #1
7 5225
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*****@newsgr oups.nospam> wrote in message
news:e1******** ******@TK2MSFTN GP10.phx.gbl...
I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
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_Beg inRequest is not getting executed
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)

' Fires at the beginning of each request

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

Dim Context As HttpContext = HttpContext.Cur rent

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

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

Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))

Dim id As Integer

id = database.getId( laname)

Dim navpath() As String = database.naviga tion(id)

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

Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))

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

Dim NewLidpath As String

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

Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))

Dim typepath As String

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

Context.Rewrite Path(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*****@newsgr oups.nospam>
| References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > 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_Beg inRequest is not getting executed
| > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
| >
| > ' Fires at the beginning of each request
| >
| > Response.Write( "<script language=jscrip t>alert('" & "inside appbegin
| > request" & "')</script>")
| >
| > Dim Context As HttpContext = HttpContext.Cur rent
| >
| > Dim oldpath As String = Context.Request .Path.ToLower()
| >
| > Dim lastpath() As String = Split(oldpath, "/")
| >
| > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))
| >
| > Dim id As Integer
| >
| > id = database.getId( laname)
| >
| > Dim navpath() As String = database.naviga tion(id)
| >
| > Dim Newpath As String = oldpath.Replace (token & strName & "/index.aspx",
| > "/user/home.aspx?actio n=1&cid=" & id)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim strold As String = oldpath.Substri ng(proIndex, i - proIndex) & "-"
| >
| > Dim NewLidpath As String
| >
| > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > "/user/moreinfo.aspx?l id=" & strLid)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim typepath As String
| >
| > typepath = oldpath.Replace (token & strName & ".aspx",
| > "/user/type.aspx?ptype =" & strName)
| >
| > Context.Rewrite Path(typepath)
| >
| > End If
| >
| > End If
| >
| > End Sub
| >
| >
|
|
|

Nov 19 '05 #3
i put the code for alert box in first line of Application_Beg inRequest
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_begi nrequest 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******** *****@TK2MSFTNG XA01.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*****@newsgr oups.nospam>
| References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > 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_Beg inRequest is not getting executed
| > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
| >
| > ' Fires at the beginning of each request
| >
| > Response.Write( "<script language=jscrip t>alert('" & "inside appbegin
| > request" & "')</script>")
| >
| > Dim Context As HttpContext = HttpContext.Cur rent
| >
| > Dim oldpath As String = Context.Request .Path.ToLower()
| >
| > Dim lastpath() As String = Split(oldpath, "/")
| >
| > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))
| >
| > Dim id As Integer
| >
| > id = database.getId( laname)
| >
| > Dim navpath() As String = database.naviga tion(id)
| >
| > Dim Newpath As String = oldpath.Replace (token & strName & "/index.aspx", | > "/user/home.aspx?actio n=1&cid=" & id)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim strold As String = oldpath.Substri ng(proIndex, i - proIndex) & "-"
| >
| > Dim NewLidpath As String
| >
| > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > "/user/moreinfo.aspx?l id=" & strLid)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim typepath As String
| >
| > typepath = oldpath.Replace (token & strName & ".aspx",
| > "/user/type.aspx?ptype =" & strName)
| >
| > Context.Rewrite Path(typepath)
| >
| > End If
| >
| > End If
| >
| > End Sub
| >
| >
|
|
|

Nov 19 '05 #4
For fake url it is even not going to Application_Beg inRequest
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******** *****@TK2MSFTNG XA01.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*****@newsgr oups.nospam>
| References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > 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_Beg inRequest is not getting executed
| > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
| >
| > ' Fires at the beginning of each request
| >
| > Response.Write( "<script language=jscrip t>alert('" & "inside appbegin
| > request" & "')</script>")
| >
| > Dim Context As HttpContext = HttpContext.Cur rent
| >
| > Dim oldpath As String = Context.Request .Path.ToLower()
| >
| > Dim lastpath() As String = Split(oldpath, "/")
| >
| > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))
| >
| > Dim id As Integer
| >
| > id = database.getId( laname)
| >
| > Dim navpath() As String = database.naviga tion(id)
| >
| > Dim Newpath As String = oldpath.Replace (token & strName & "/index.aspx", | > "/user/home.aspx?actio n=1&cid=" & id)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim strold As String = oldpath.Substri ng(proIndex, i - proIndex) & "-"
| >
| > Dim NewLidpath As String
| >
| > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > "/user/moreinfo.aspx?l id=" & strLid)
| >
| > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| >
| > Dim typepath As String
| >
| > typepath = oldpath.Replace (token & strName & ".aspx",
| > "/user/type.aspx?ptype =" & strName)
| >
| > Context.Rewrite Path(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_Beg inRequest
======

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.dl l. 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*****@newsgr oups.nospam>
| References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
<#H************ **@TK2MSFTNGP12 .phx.gbl>
<Fq************ *@TK2MSFTNGXA01 .phx.gbl>
| Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1108 97
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| For fake url it is even not going to Application_Beg inRequest
| 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******** *****@TK2MSFTNG XA01.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*****@newsgr oups.nospam>
| > | References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| > | Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com
61.16.176.148
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| > | news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > | > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > | > 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_Beg inRequest is not getting executed
| > | > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
| > EventArgs)
| > | >
| > | > ' Fires at the beginning of each request
| > | >
| > | > Response.Write( "<script language=jscrip t>alert('" & "inside appbegin
| > | > request" & "')</script>")
| > | >
| > | > Dim Context As HttpContext = HttpContext.Cur rent
| > | >
| > | > Dim oldpath As String = Context.Request .Path.ToLower()
| > | >
| > | > Dim lastpath() As String = Split(oldpath, "/")
| > | >
| > | > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim id As Integer
| > | >
| > | > id = database.getId( laname)
| > | >
| > | > Dim navpath() As String = database.naviga tion(id)
| > | >
| > | > Dim Newpath As String = oldpath.Replace (token & strName &
| "/index.aspx",
| > | > "/user/home.aspx?actio n=1&cid=" & id)
| > | >
| > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim strold As String = oldpath.Substri ng(proIndex, i - proIndex) &
"-"
| > | >
| > | > Dim NewLidpath As String
| > | >
| > | > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > | > "/user/moreinfo.aspx?l id=" & strLid)
| > | >
| > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim typepath As String
| > | >
| > | > typepath = oldpath.Replace (token & strName & ".aspx",
| > | > "/user/type.aspx?ptype =" & strName)
| > | >
| > | > Context.Rewrite Path(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******** *****@TK2MSFTNG XA01.phx.gbl...
Hi Ankit,

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

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.dl l. 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*****@newsgr oups.nospam>
| References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
<#H************ **@TK2MSFTNGP12 .phx.gbl>
<Fq************ *@TK2MSFTNGXA01 .phx.gbl>
| Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1108 97
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| For fake url it is even not going to Application_Beg inRequest
| 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******** *****@TK2MSFTNG XA01.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*****@newsgr oups.nospam>
| > | References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| > | Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com
61.16.176.148
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl | > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| > | news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > | > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > | > 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_Beg inRequest is not getting executed
| > | > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
| > EventArgs)
| > | >
| > | > ' Fires at the beginning of each request
| > | >
| > | > Response.Write( "<script language=jscrip t>alert('" & "inside appbegin | > | > request" & "')</script>")
| > | >
| > | > Dim Context As HttpContext = HttpContext.Cur rent
| > | >
| > | > Dim oldpath As String = Context.Request .Path.ToLower()
| > | >
| > | > Dim lastpath() As String = Split(oldpath, "/")
| > | >
| > | > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim id As Integer
| > | >
| > | > id = database.getId( laname)
| > | >
| > | > Dim navpath() As String = database.naviga tion(id)
| > | >
| > | > Dim Newpath As String = oldpath.Replace (token & strName &
| "/index.aspx",
| > | > "/user/home.aspx?actio n=1&cid=" & id)
| > | >
| > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim strold As String = oldpath.Substri ng(proIndex, i - proIndex) &
"-"
| > | >
| > | > Dim NewLidpath As String
| > | >
| > | > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > | > "/user/moreinfo.aspx?l id=" & strLid)
| > | >
| > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| > | >
| > | > Dim typepath As String
| > | >
| > | > typepath = oldpath.Replace (token & strName & ".aspx",
| > | > "/user/type.aspx?ptype =" & strName)
| > | >
| > | > Context.Rewrite Path(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*****@newsgr oups.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_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com 61.16.176.148
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1110 70
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Thanks that was the exact problem
| it gets solved now
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:L3******** *****@TK2MSFTNG XA01.phx.gbl...
| > Hi Ankit,
| >
| > Since you mentioned that
| > =======
| > For fake url it is even not going to Application_Beg inRequest
| > ======
| >
| > 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.dl l. 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*****@newsgr oups.nospam>
| > | References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| > <#H************ **@TK2MSFTNGP12 .phx.gbl>
| > <Fq************ *@TK2MSFTNGXA01 .phx.gbl>
| > | Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com
61.16.176.148
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:1108 97
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | For fake url it is even not going to Application_Beg inRequest
| > | 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******** *****@TK2MSFTNG XA01.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*****@newsgr oups.nospam>
| > | > | References: <e1************ **@TK2MSFTNGP10 .phx.gbl>
| > | > | Subject: Re: Application_Beg inRequest -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.publi c.dotnet.framew ork.aspnet
| > | > | NNTP-Posting-Host: hotwire-148-176-16-del.hotwireindi a.com
| > 61.16.176.148
| > | > | Path:
| TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | > | Xref: TK2MSFTNGXA01.p hx.gbl
| > | > microsoft.publi c.dotnet.framew ork.aspnet:1108 22
| > | > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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*****@newsgr oups.nospam> wrote in message
| > | > | news:e1******** ******@TK2MSFTN GP10.phx.gbl...
| > | > | > I put the code for url rewrite in my Application_Beg inRequest 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_Beg inRequest
| > | > | > 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_Beg inRequest is not getting executed
| > | > | > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
| > | > EventArgs)
| > | > | >
| > | > | > ' Fires at the beginning of each request
| > | > | >
| > | > | > Response.Write( "<script language=jscrip t>alert('" & "inside
| appbegin
| > | > | > request" & "')</script>")
| > | > | >
| > | > | > Dim Context As HttpContext = HttpContext.Cur rent
| > | > | >
| > | > | > Dim oldpath As String = Context.Request .Path.ToLower()
| > | > | >
| > | > | > Dim lastpath() As String = Split(oldpath, "/")
| > | > | >
| > | > | > Dim laname As String = lastpath.GetVal ue(lastpath.Len gth - 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.Substri ng(i + len, j - (i +
len))
| > | > | >
| > | > | > Dim id As Integer
| > | > | >
| > | > | > id = database.getId( laname)
| > | > | >
| > | > | > Dim navpath() As String = database.naviga tion(id)
| > | > | >
| > | > | > Dim Newpath As String = oldpath.Replace (token & strName &
| > | "/index.aspx",
| > | > | > "/user/home.aspx?actio n=1&cid=" & id)
| > | > | >
| > | > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i + len))
| > | > | >
| > | > | > Dim strold As String = oldpath.Substri ng(proIndex, i -
proIndex) &
| > "-"
| > | > | >
| > | > | > Dim NewLidpath As String
| > | > | >
| > | > | > NewLidpath = oldpath.Replace (strold & strLid & ".aspx",
| > | > | > "/user/moreinfo.aspx?l id=" & strLid)
| > | > | >
| > | > | > Context.Rewrite Path(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.Substri ng(i + len, j - (i +
len))
| > | > | >
| > | > | > Dim typepath As String
| > | > | >
| > | > | > typepath = oldpath.Replace (token & strName & ".aspx",
| > | > | > "/user/type.aspx?ptype =" & strName)
| > | > | >
| > | > | > Context.Rewrite Path(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
1490
by: Daniel | last post by:
in Application_BeginRequest how do i cancel the request and send back a message?
1
1772
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 authenticate and keep folks from hacking the URL. Is there a way to read the CommandArgument and CommandName from the Application_BeginRequest?
3
18353
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 the code below, I get the following error... "System.NullReferenceException: Object reference not set to an instance of an object" ****************************************** protected void Session_Start(Object sender, EventArgs e) { System.Uri...
1
1658
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 several webservices return a DataSet with the information requested. All the methods of the Webservices also go through an initial phase of checking either the Backoffice systems are online or not. If not, they all return the SAME error DataSet.
0
1428
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 Request. So in my Application_Beginrequest function i am writing a line to the event viewer.I see that for each request my event viewer has 3 entries.
3
8052
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 also manually created 'App_Code' with the start code as below: Imports System.Security Imports System.Security.Principal
19
3586
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 dynamically, something like: protected void Application_BeginRequest(Object sender, EventArgs e) { if (Session == "True")
2
2208
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 the global.asax file? I was gonna write some basic details such as the username requesting the page, the name of the page, and any querystring parameters
7
2575
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 example: If I call www.mysite.com/UserName. I want to rewrite the UserName part. This works fine in my dev environment but when I publish the site Application_BeginRequest does not get called for this URL. It does however get called for any of the...
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.