开发者

How do I pass querystring to an httphandler?

Passing an id though the querystring to an httphanlder was not so hard in a bindable control like a gridview. I put an imagebutton in the gridview and set its Imageurl Property as such....

ImageUrl='<%#"~\Handlers\ImageHandler.ashx?id=" & Eval("ID") 

However, now I am trying to just use a standard Imagebutton control just sitting ther开发者_开发问答e on a user control. I call this method I created on the user control:

Public Sub LoadImage()

    Dim sb As New StringBuilder

    sb.Append("~\Handlers\ImageHandler.ashx")
    sb.Append("?imageSourceCode=" & _imageSourceCode.ToString)
    sb.Append("&displayTypeCode=" & _displayTypeCode.ToString)
    sb.Append("&imageData=" & _imageData.ToString)

    imgbtnImage.ImageUrl = sb.ToString

End Sub

...in an attempt to pass some paramters into the httphandler, but once inside, it doesn't see them. The I noticed I had also harded an ImageUrl property on the imagecontrol itself to point to the handler w/o querystring. So, I deleted that and now it fails completely!


This may be your problem:

ImageUrl='<%# "~\Handlers\ImageHandler.ashx?id=" & Eval("ID") %>'


Try resolving the url before assigning it to the image.

imgbtnImage.ImageUrl = ResolveUrl(sb.ToString)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜