Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

asp classic - Error in code for download a file(txt) in clasic ASP -


i have been trying 2 diferent codes one:

nombre="prueba.txt" set stream = server.createobject("adodb.stream") stream.open stream.type = 2 ' binary stream.loadfromfile(server.mappath("./file/"&nombre)) response.binarywrite(stream.read) 

and other code i'm trying :

response.contenttype = "application/x-unknown" ' arbitrary   fpath = server.mappath("./file/"&nombre)  response.addheader "content-disposition","attachment; filename=" & nombre   set adostream = createobject("adodb.stream")  adostream.open()  adostream.type = 1  adostream.loadfromfile(fpath)  response.binarywrite adostream.read()  adostream.close  set adostream = nothing   response.end  

and have found non especificated/defined data type.

@giancarlo solarino: try --

option explicit  dim sfilename, sfilepath, ifilesize dim ofile, ofs, ostream  sfilename = "prueba.txt" sfilepath = server.mappath("file/" & sfilename)  set ofs = server.createobject("scripting.filesystemobject")  if ofs.fileexists(sfilepath)     set ofile = ofs.getfile(sfilepath)     ifilesize = ofile.size     set ofile = nothing      response.addheader "content-disposition","attachment; filename=" & sfilename     response.contenttype = "application/download"     response.addheader "content-length", ifilesize      set ostream = server.createobject("adodb.stream")     ostream.open     ostream.type = 1     ostream.loadfromfile sfilepath      while not ostream.eos , response.isclientconnected         response.binarywrite ostream.read(1024)         response.flush()     loop      ostream.close     set ostream = nothing end if 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -