wooikeim Posted March 28, 2007 Share Posted March 28, 2007 sub Datagrid1_ItemCommand (sender as object, e as DataGridCommandEventArgs) if (e.CommandName= "Download") then Response.ContentType = "application\octet-stream" Dim filename as string=new string("C:\Inetpub\wwwroot\tution\doc") Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#") downloadFile.Close() Response.WriteFile(filename) Response.Flush() Response.End()I got the problem in downloading a file, it show me End of statement expected. i not sure my code correct or not. please kindly tell me what happen here. thanks......this line is highlighted <Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) > Link to comment Share on other sites More sharing options...
pulpfiction Posted March 28, 2007 Share Posted March 28, 2007 Try giving Response.write...... in next line.Response.ContentType = "application\octet-stream"Dim filename as string=new string("C:\Inetpub\wwwroot\tution\doc")Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#")downloadFile.Close()Response.WriteFile(filename)Response.Flush()Response.End() Link to comment Share on other sites More sharing options...
wooikeim Posted March 28, 2007 Author Share Posted March 28, 2007 You refer my code above, Response.Write(downloadFile.Length() & "#") is already there. So whats the problem Link to comment Share on other sites More sharing options...
pulpfiction Posted March 28, 2007 Share Posted March 28, 2007 Saw that, I said "try giving in the NEXT LINE" Link to comment Share on other sites More sharing options...
wooikeim Posted March 28, 2007 Author Share Posted March 28, 2007 Oh, I'm so sorry, didnt see that statement. Anyway, i have put it in the next line, but then got another error.Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) <Access denied >error msg- To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.I had follow that instruction but still cant work Link to comment Share on other sites More sharing options...
wooikeim Posted March 31, 2007 Author Share Posted March 31, 2007 No Solution for this? Or anyone got any code for downloading in .Net vbscript? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now