473,405 Members | 2,279 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,405 software developers and data experts.

HttpHandlerFactory & QueryString

I'm using a set of HttpHandlers in my site to parse out the path and write
content based on information in that path, including the querystring.
Rather than have multiple entries in the web.config file, I thought I'd
instead create an HttpHandlerFactory that would analyze the path information
and then hand over the rest of the content generation to a specific
HttpHandler. My code is something like this...

Public Class ExportHandlerFactory
Implements IHttpHandlerFactory

Public Function GetHandler(ByVal context As HttpContext, ByVal
requestType As String, ByVal url As String, ByVal pathTranslated As String)
As IHttpHandler
Implements GetHandler

Select Case Path.GetFileNameWithoutExtension(url).ToLower()
Case "path-a"
Return New aPathHttpHandler
Case "path-b"
Return New bPathHttpHandler
Case Else
Return
PageParser.GetCompiledPageInstance("~/default.aspx",
context.Server.MapPath("~/default.aspx"), context)
End Select
End Function

Public Sub ReleaseHandler(ByVal handler As System.Web.IHttpHandler)
Implements System.Web.IHttpHandlerFactory.ReleaseHandler

End Sub
End Class

aPathHttpHandler and bPathHttpHandler are both handlers in the App_Code
directory. The problem with this approach is that aPathHttpHandler and
bPathHttpHander then have no querystring to read to analyze for creating
their content to write to the context.Response.

I've thought about just analyzing the querystring in the HttpHandlerFactory
and writing the querystring values to the context.Items collection, but I
want my HttpHandlers to be able to be standalone classes that won't depend
on the HttpHandlerFactory to do this.

Any inspiration or nuggets of wisdom on this would be appreciated.
Nov 29 '07 #1
0 971

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

Similar topics

3
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
4
by: Luklrc | last post by:
Hi, I'm having to create a querysting with javascript. My problem is that javscript turns the "&" characher into "&amp;" when it gets used as a querystring in the url EG: ...
12
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: ...
0
by: Martin Maurer | last post by:
Hello, i have a problem with NameValueCollection.Add or better with converting to a QueryString: NameValueCollection myQueryStringCollection = new NameValueCollection();...
2
by: Mehdi | last post by:
Hi, I need to pass an URL via a hidden value as follow: <input type="hidden" id="Test" runat="Server"> and on Page_Load I assign a value to this hidden input as follow: Test.Value =...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
0
by: walter | last post by:
Hi there, I meet with a strange behavior -- I add a custom httphandlerfactory in web.config and map * to this new factory, <add path="*".... When I try it in the build-in iis from VS2005, it catch...
3
by: Elroyskimms | last post by:
I have to encode an address which contains an ampersand (&) into a URL with various querystring parameters. The following code works fine: URLString = "www.myserver.com?AD1=" &...
3
by: Tony | last post by:
I see that many pages have &amp; in querystring instead &. What is difference? Can I put page link (url) www.mysite.com/mypage.aspx?lang=EN&ID=15 or I need to write...
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:
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
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...
0
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,...
0
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...

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.