asp.net newbie question on url redirect to a file for downloads

N

news.microsoft.com

All,

i have created a page that allows information to be extracted from a
database i am able to save this into a virtual folder no problems.

what i want to do is then redirect through url to all the user to download
this file.

can somebody direct me in the direction of a good site :)

Simon Whale
 
G

Guest

Let me know my understanding is correct.

When a user browse this page, it will extract the info from database and
store it in the virtual folder. Then it should popup a save dialog box.

Soln: After saving the file to the virtual folder, you can form a url
according to Virtual folder + file. Then use Response.Redirect to that url,
it will automatically popup the save dialog.

Thanks,
Ragu.
 
N

news.microsoft.com

THanks Ragu

i am now getting the following error from


Server Error in '/datacounts' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 145: sw = Nothing
Line 146:
Line 147: rd.Redirect(file)
Line 148: dr.Close()
Line 149: cn.Close()


Source File: c:\inetpub\wwwroot\datacounts\WebForm1.aspx.vb Line: 147

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]
datacounts.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\datacounts\WebForm1.aspx.vb:147
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()



any ideas on what to do next or look for as i am stumped

Many thanks
Simon Whale
 
G

Guest

Hi,
Change the 147 line to

Line 147: Response.Redirect(file)

What its means rd.Redirect(...)?

Whether the file is whole url??? (It should be url)

Thanks,
Ragu.

news.microsoft.com said:
THanks Ragu

i am now getting the following error from


Server Error in '/datacounts' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 145: sw = Nothing
Line 146:
Line 147: rd.Redirect(file)
Line 148: dr.Close()
Line 149: cn.Close()


Source File: c:\inetpub\wwwroot\datacounts\WebForm1.aspx.vb Line: 147

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]
datacounts.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\datacounts\WebForm1.aspx.vb:147
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()



any ideas on what to do next or look for as i am stumped

Many thanks
Simon Whale
Ragunathan said:
Let me know my understanding is correct.

When a user browse this page, it will extract the info from database and
store it in the virtual folder. Then it should popup a save dialog box.

Soln: After saving the file to the virtual folder, you can form a url
according to Virtual folder + file. Then use Response.Redirect to that
url,
it will automatically popup the save dialog.

Thanks,
Ragu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top