473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Add httphanlder

Sir,

I am very new to ASP.NET.

Trying to create a Httphanlder myself.

1. I create a httphandler called qqweb.vb and put it under /bin folder.
qqweb has namespace qqweb and class qqhandler
2. I add the following into web.config.
<httpModules>
<add name="HTTPHandler" type="qqweb.qqhanlder, qqweb" />
</httpModules>

3. It always return an error with file or assembly not found.

What should I do? I am using web matrix. Can I use a .vb or .ashx instead of
..dll file?

I am tried to compile file under web matrix using an add in. But it always
give an error like ": Name 'InStr' is not declared."
What should I do?

Thanks in advanced for your help!!!
Nov 18 '05 #1
3 1324
Hi,

if you create HttpHandler, you need to register it within <httpHandlers>
element. <httpModules> is, as its name states, for HTTP modules which are
different concept from HTTP handlers. You need also to register the
extension you use for the HTTP handler in IIS to aspnet_isapi.dll so that
request for the extension is forwarded to ASP.NET

So which one you are really trying to create, HTTP module or HTTP handler?
HttpHandler is for processing the request, HTTP modules for doing work
before or after the handler has done its job (pre- and postprocessing the
request).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Guoqi Zheng" <no@sorry.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Sir,

I am very new to ASP.NET.

Trying to create a Httphanlder myself.

1. I create a httphandler called qqweb.vb and put it under /bin folder.
qqweb has namespace qqweb and class qqhandler
2. I add the following into web.config.
<httpModules>
<add name="HTTPHandler" type="qqweb.qqhanlder, qqweb" />
</httpModules>

3. It always return an error with file or assembly not found.

What should I do? I am using web matrix. Can I use a .vb or .ashx instead of .dll file?

I am tried to compile file under web matrix using an add in. But it always
give an error like ": Name 'InStr' is not declared."
What should I do?

Thanks in advanced for your help!!!

Nov 18 '05 #2

Thanks a lot for your quick reply. I think what I am doing is httphandler.

I am not really sure. I am using it to create search engine friendly URL.

Please see my code below.

I tried to register it by <httpHandlers>, but it seems that asp.net can not
recognize <httpHandlers>.
Imports System
Imports System.Web
Imports system.Configuration
Imports system.Text

Namespace qqweb

Public Class HTTPHandler
Implements IHttpModule
Public Sub Init(ByVal app As HttpApplication) Implements
IHttpModule.Init
AddHandler app.BeginRequest, AddressOf Me.OnBeginRequest
End Sub
Public Sub Dispose() Implements IHttpModule.Dispose
End Sub

Public Delegate Sub MyEventHandler(ByVal s As Object, ByVal e As
EventArgs)
Public Event MyEvent As MyEventHandler

Public Sub OnBeginRequest(ByVal s As Object, ByVal e As EventArgs)
Dim objHttpApplication As HttpApplication = CType(s, HttpApplication)
'check for a director path being sent instead of the query string.
Dim sURL As String = objHttpApplication.Request.Url.ToString.ToLower
If InStr(sURL, "/product/") <> 0 Then
'now we'll replace the paths with the appropriate query strings.
Dim sNewURL As String = Replace(sURL, "/Product/", "?product="
' sNewURL = Replace(sNewURL, "/site/", "&site=")
'now we'll rewrite the directory path and send our script a query
string
'that it can deal with.
objHttpApplication.Context.RewritePath("~/product.aspx" & sNewURL)
End If
End Sub

End Class
End Namespace
--
Met vriendelijke groet,

Guoqi Zheng
Tel: +31 (0) 23 5343545
http://www.meetholland.com
"Teemu Keiski" <jo****@aspalliance.com> дÈëÏûÏ¢ÐÂÎÅ
:e0**************@TK2MSFTNGP09.phx.gbl...
Hi,

if you create HttpHandler, you need to register it within <httpHandlers>
element. <httpModules> is, as its name states, for HTTP modules which are
different concept from HTTP handlers. You need also to register the
extension you use for the HTTP handler in IIS to aspnet_isapi.dll so that
request for the extension is forwarded to ASP.NET

So which one you are really trying to create, HTTP module or HTTP handler?
HttpHandler is for processing the request, HTTP modules for doing work
before or after the handler has done its job (pre- and postprocessing the
request).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Guoqi Zheng" <no@sorry.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Sir,

I am very new to ASP.NET.

Trying to create a Httphanlder myself.

1. I create a httphandler called qqweb.vb and put it under /bin folder.
qqweb has namespace qqweb and class qqhandler
2. I add the following into web.config.
<httpModules>
<add name="HTTPHandler" type="qqweb.qqhanlder, qqweb" />
</httpModules>

3. It always return an error with file or assembly not found.

What should I do? I am using web matrix. Can I use a .vb or .ashx instead
of
.dll file?

I am tried to compile file under web matrix using an add in. But it

always give an error like ": Name 'InStr' is not declared."
What should I do?

Thanks in advanced for your help!!!


Nov 18 '05 #3
It is HTTP module as you implement IHttpModule interface. OK, you had error
with InStr, try importing Microsoft.VisualBasic namespace as I believe InStr
function is for backward compatibility.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Guoqi Zheng" <no@sorry.com> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl...

Thanks a lot for your quick reply. I think what I am doing is httphandler.

I am not really sure. I am using it to create search engine friendly URL.

Please see my code below.

I tried to register it by <httpHandlers>, but it seems that asp.net can not recognize <httpHandlers>.
Imports System
Imports System.Web
Imports system.Configuration
Imports system.Text

Namespace qqweb

Public Class HTTPHandler
Implements IHttpModule
Public Sub Init(ByVal app As HttpApplication) Implements
IHttpModule.Init
AddHandler app.BeginRequest, AddressOf Me.OnBeginRequest
End Sub
Public Sub Dispose() Implements IHttpModule.Dispose
End Sub

Public Delegate Sub MyEventHandler(ByVal s As Object, ByVal e As
EventArgs)
Public Event MyEvent As MyEventHandler

Public Sub OnBeginRequest(ByVal s As Object, ByVal e As EventArgs)
Dim objHttpApplication As HttpApplication = CType(s, HttpApplication) 'check for a director path being sent instead of the query string.
Dim sURL As String = objHttpApplication.Request.Url.ToString.ToLower
If InStr(sURL, "/product/") <> 0 Then
'now we'll replace the paths with the appropriate query strings.
Dim sNewURL As String = Replace(sURL, "/Product/", "?product="
' sNewURL = Replace(sNewURL, "/site/", "&site=")
'now we'll rewrite the directory path and send our script a query
string
'that it can deal with.
objHttpApplication.Context.RewritePath("~/product.aspx" & sNewURL)
End If
End Sub

End Class
End Namespace
--
Met vriendelijke groet,

Guoqi Zheng
Tel: +31 (0) 23 5343545
http://www.meetholland.com
"Teemu Keiski" <jo****@aspalliance.com> дÈëÏûÏ¢ÐÂÎÅ
:e0**************@TK2MSFTNGP09.phx.gbl...
Hi,

if you create HttpHandler, you need to register it within <httpHandlers>
element. <httpModules> is, as its name states, for HTTP modules which are
different concept from HTTP handlers. You need also to register the
extension you use for the HTTP handler in IIS to aspnet_isapi.dll so that request for the extension is forwarded to ASP.NET

So which one you are really trying to create, HTTP module or HTTP handler? HttpHandler is for processing the request, HTTP modules for doing work
before or after the handler has done its job (pre- and postprocessing the request).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Guoqi Zheng" <no@sorry.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Sir,

I am very new to ASP.NET.

Trying to create a Httphanlder myself.

1. I create a httphandler called qqweb.vb and put it under /bin folder. qqweb has namespace qqweb and class qqhandler
2. I add the following into web.config.
<httpModules>
<add name="HTTPHandler" type="qqweb.qqhanlder, qqweb" />
</httpModules>

3. It always return an error with file or assembly not found.

What should I do? I am using web matrix. Can I use a .vb or .ashx

instead
of
.dll file?

I am tried to compile file under web matrix using an add in. But it

always give an error like ": Name 'InStr' is not declared."
What should I do?

Thanks in advanced for your help!!!



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
4
by: Jeremy Lew | last post by:
When my HttpHandler is processing a request when installed on a particular 2003 Server machine, the Context.Session object is null. Any idea why this might be? My handler implements...
3
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
6
by: David Bowey | last post by:
Hi There! I'm writing a custom HttpHandler to create watermarks on my PNG images of my website. So typically, a PNG image is linked in an ASPX page as follows... <img src="images/test.png"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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...

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.