|
a user have logged into a website having video files. He when clicks the download button a dialog box should open asking where the video file should be saved.when he gives a path
it should start downloading...hw to code it in c# .i am using asp.net 2.0..
|
|
|
|
|
Try this but sorry its in VB:
Dim strFolderPath As String = AppDomain.CurrentDomain.BaseDirectory() & "02\TMCoverageArea\"
Dim strFilePath As String
strFilePath = strFolderPath & hlkCoverageArea.Text
DownloadFile(strFilePath, True)
Private Sub DownloadFile(ByVal FilePath As String, ByVal ForceToDownload As Boolean)
'Dim path As Path
Dim strFullFilePath = IO.Path.GetFullPath(FilePath)
Dim strFileName = IO.Path.GetFileName(strFullFilePath)
Dim strExtension = IO.Path.GetExtension(strFullFilePath)
Dim strFileType As String = ""
If Not IsDBNull(strExtension) Then
strExtension = LCase(strExtension)
End If
strFileType = GetFileTypeFromExtension(strExtension)
If (ForceToDownload) Then
Response.AppendHeader("content-disposition", _
"attachment; filename=" + strFileName)
End If
If strFileType <> "" Then
Response.ContentType = strFileType
End If
Response.WriteFile(strFullFilePath)
Response.End()
End Sub
Public Function GetFileTypeFromExtension(ByVal FileExtension As String) As String
Try
Dim strFileType As String = ""
Select Case FileExtension
Case ".htm", ".html"
strFileType = "text/HTML"
Case ".txt"
strFileType = "text/plain"
Case ".doc", ".rtf"
strFileType = "Application/msword"
Case ".csv", ".xls"
strFileType = "Application/x-msexcel"
Case Else
strFileType = "text/plain"
End Select
Return strFileType
Catch ex As Exception
End Try
End Function
|
|
|
|
|
hi vsree,
the actual code where iam getting the exception is at try catch block for response.redirect statement
the code is
Response.Redirect("somepage.aspx");
plz help me
regards
chaitu
chaitanya
|
|
|
|
|
Why you have placed this query 8 times???
|
|
|
|
|
chaitanya
Can you give the coding of what you are doing in that popup?
Because with Response.Redirect("..");, we cant find anything...
Also avoid posting multiple threads
|
|
|
|
|
hi vsree,
the actual code where iam getting the exception is at try catch block for response.redirect statement
the code is
Response.Redirect("somepage.aspx");
plz help me
regards
chaitu
|
|
|
|
|
hi vsree,
the actual code where iam getting the exception is at try catch block for response.redirect statement
the code is
Response.Redirect("somepage.aspx");
plz help me
regards
chaitu
|
|
|
|
|
Don't put the redirect in a try catch block. You are catching the exception that the response method is using to stop the execution.
---
single minded; short sighted; long gone;
|
|
|
|
|
An Alarming Web Site with Asp.NET and C# -
How Can I perform two job every half of an hour?
The Job is;
-Performing an SQL query
-Send "true" returns to each mailing adresses
Thanks and regards
Bilgin KILIÇ
blgnklc
|
|
|
|
|
You can do it in SQL Server itself...
|
|
|
|
|
Could you send me an article about my aim.
Thanks
Bilgin KILIÇ
blgnklc
|
|
|
|
|
Hi,
I'm having this error,
'Bsc_Test1.src.controls.cont' does not contain a definition for 'ChartTitle'
'Bsc_Test1.src.controls.cont' does not contain a definition for 'gcolors'
'Bsc_Test1.src.controls.cont' does not contain a definition for 'XAxisTitle'
'Bsc_Test1.src.controls.cont' does not contain a definition for 'YAxisItems'
'Bsc_Test1.src.controls.cont' does not contain a definition for 'YAxisValues'
There definition is not writen in the back end code but it's in HTML of cont and cont is in folder src/controls. Please help me solve this.
Thanks.
|
|
|
|
|
i have a menu but my sub menus are so much i wanna split my sub menu strip
to show it like windows start up menu when our program is too much all programs sub menu show in 2 or 3 pages beside each other
how can i do my menu as start menu windows on my web application(c#)
Redgards
|
|
|
|
|
when redirecting one one page to other page and back again iam getting unknown error popup and the exception catched is 'Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack'
plz help me regarding the error
regards
chaitu
|
|
|
|
|
i guess u posted the same question yestreday too!!
Gautham
|
|
|
|
|
Are you doing any evaluation in the popup form?
Can you paste the actual code where the error occurs?
|
|
|
|
|
I've finished the form design only til now...started the backend part just now in oracle...yet to do the coding part...can u suggest some ideas as to how to write the coding???? got to finish my project by feb 15th
|
|
|
|
|
i understand the concept wat u've explained but how to write the code 4 it?? can u explain wats the logic behind it??
|
|
|
|
|
No one can tell you whole business logic .......
first think what you want then start ti implement it if any problem arrives post query
|
|
|
|
|
Let me know once your are done with your databse design. What does your UI comprise of? Then lets see what we can do!!!
Gautham
|
|
|
|
|
hi
my UI consists of the following webforms :
home
packages
profile
terms & conditions
contact us
bookings
in bookings webform only i've created the login form where user 'll enter his details..i'm expected to show the ticket availability also wen the user requests for it thats wat i dono how to do...
|
|
|
|
|
hi
i've designed the form for my project...and created the bookings,different packages & transaction tables in oracle...only coding part to be done..
|
|
|
|
|
1)To start with open a connection(oracle)
2)Create a command object.
3)Since you are a learner give direct query as command text
4)the query shoule have what you want to obtain according to the clients' selection
5)you can use datareader or dataadapter as well.
6)if using datareader give commandname.executereader()
Gautham
|
|
|
|
|
then i've included the reset button along with the ok button in my form....to reset pls check if my code is right
textbox1.text = ""
bec by giving this the text is not getting cleared
|
|
|
|
|
Hi,
I have a Datagrid in which iam displaying EmployeeName and sum other details.
The employeeName In the Datagrid is a Hyperlink Column fromwhich i open another Employee Form in edit mode.I want to disable the hyperlink for normal users.
I have tried disabling the link using : e.Item.Cells(1).Enabled = False
But it is still clickable. I dont want it to be clickable. How to go about in doing this?
following is the aspx code:
<asp:HyperLinkColumn DataNavigateUrlField="EmpId" DataNavigateUrlFormatString="FrmEditEmp.aspx?EmpID={0}" DataTextField="EmpName" HeaderText="EmpName">
<ItemStyle Width="20%"></ItemStyle>
</asp:HyperLinkColumn>
Plz help me out ...
Thanks,
Riz
|
|
|
|