Authorize before download a file in asp.net

B

Ben Chen

Could any one tell me how to deal with the following problem:

If user has not login the system, when he click the url for downloading a
file he will be re-direct to the
login page. Just as I download the sample code in Codeproject.com.

Thanks all
 
G

Guest

Hi Ben,
I am not sure how it is Done Code Project, but a simple logic whihc i can
derive is have the LinkButton on the webpage for downloading, when the user
clicks on the download link. in the LinkButton_Click event Check for the
Valid User something like
if(Session["UserName"].ToString().Length<=0)
Server.Transfer("Login.aspx");
else
Response.write("<Script>location.href='Download.zip'</script>");

Hope this works for you i do remember doing this a long time back.. i do not
have the code right now.

but this will have impact on the post back!!

so the Redirecting
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top