RE: Authorize before download a file in asp.net

From: Praveen K (PraveenK_at_discussions.microsoft.com)
Date: 10/11/04


Date: Mon, 11 Oct 2004 04:03:03 -0700

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

"Ben Chen" wrote:

> 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
>
>
>