vb.net - form upload get other form variables in asp.net -
i have asp.net form upload box copied msdn. after form submitted, instead of displaying information on page, want page redirect 2 query parameters, filename , number hidden form field, in same form , upload box. how can number after form submits add redirect code. form field name 'id'
<script runat="server"> protected sub button1_click(byval sender object, _ byval e system.eventargs) if fileupload1.hasfile try fileupload1.saveas("c:\inetpub\sites\rebbetzin\uploads\" & _ fileupload1.filename) label1.text = "file name: " & _ fileupload1.postedfile.filename & "<br>" & _ "file size: " & _ fileupload1.postedfile.contentlength & " kb<br>" & _ "content type: " & _ fileupload1.postedfile.contenttype response.redirect("http://www.rebbetzins.org/thanks.asp?id=" & ______ & "&f=" & fileupload1.postedfile.filename ) catch ex exception label1.text = "error: " & ex.message.tostring() end try else label1.text = "you have not specified file." end if end sub
the value stored in request.form
collection, this:
request.form("id")
so response.redirect
code should this:
response.redirect("http://www.rebbetzins.org/thanks.aspx?id=" & request.form("id") & "&f=" & fileupload1.postedfile.filename )
note: thanks
page .aspx
, not .asp
extension, right? changed .aspx
in answer.
update:
since have asp.net server control holding hidden value, can instead:
me.id2.value
so response.redirect
this:
response.redirect("http://www.rebbetzins.org/thanks.aspx?id=" & me.id2.value & "&f=" & fileupload1.postedfile.filename )
update 2:
to populate asp.net hiddenfield control in thanks.aspx
page, need read out of query string in page_load
event, this:
protected sub page_load(sender object, e eventargs) if request.querystring("id") isnot nothing me.id2.value = request.querystring("id") end if end sub
Comments
Post a Comment