|
Hi everyone!
Please Help me I will be greatful for early response
When I click on any webpage which contain files list. webbrowser start to download that file.
my problem is this that I do not want to download the file with any downloader instead I want to redirect that file to the concerned application like if i click on for example song file i want webbrowser to open the media player and give that to media player.
i m using vs 2005 and coding with vsual basic
please help me to sort out this problem
Juli
Julian
|
|
|
|
|
Wouldn't it do this by the file association from the suffix anyway? Another approch is to stream the bytes to the output stream and set the mime type.
Try using "server.Transfer"
TadMcClellan.Com
|
|
|
|
|
I already tried file association and mime type was defined but webbrowser still tried to download the file rather then handingover to programme
please is there any programmitacaly approach with vb on asp.net page to capture the click event and redirect that event to programme like using shell command
will pray for you
Julian
|
|
|
|
|
juli Paris wrote: my problem is this that I do not want to download the file with any downloader instead I want to redirect that file to the concerned application like if i click on for example song file i want webbrowser to open the media player and give that to media player.
You can't do this as it is completely decided by the browser. If it is video files, use silverlight to play streaming videos. For other file types, it should get downloaded for accessing it.
|
|
|
|
|
What if i prepare vb.net application & insert form with webbrowser control. then is there any way to overcome this problem or still limitations will remain there. if any door is open please help to sort out that i will be grateful for cooperation
Thanks
Julian
|
|
|
|
|
If you are using windows application, I think you can use WebClient class and download the file to a temporary location which user doesn't knows. Then use Process.Start() to launch the associated application.
|
|
|
|
|
i don't know this is proper solution or not but you can try this
if you want to open that file with proper player then just run that file
when user clicks the url user process class to run that file
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
So, I have a class User , which encapsulates all user related data. The class has a static (factory) method,FromId(string id) which returns a user instance. My question is, if multiple users are requesting this method at same time, will this return correct value ? I am confused here.
public class User
{
public static User FromId(string id)
{
}
}
|
|
|
|
|
N a v a n e e t h wrote: My question is, if multiple users are requesting this method at same time, will this return correct value ?
Yes. Thread safety is only an issue if there are static variables whose values are updated within the method.
Read this article for more information[^] on the subject.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: Yes. Thread safety is only an issue if there are static variables whose values are updated within the method.
Thanks. I know this. But my method is static, not any variables. So will the thread safety issue comes here ? All my variables are instance variables.
|
|
|
|
|
I think it will return proper user if the instance that you are returning from the static function is created in that function only.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
This is my thinking. Just want to confirm it. BTW, coming after long time ? What happened ?
|
|
|
|
|
Yes, Might be I was finding less interest at CP as compare to Money control (share market) but as the market is not responding that’s why I came back to CP. Here also I didn’t find much question might be because of US Vacations in last month
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi all.
i search to find a solution to export my grid to pdf.
is any way to do it?
sepel
|
|
|
|
|
Not built into the framework. There might be some 3rd party component you could use.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
hello every one...
i can use label and textbox in javascript, and now, i am using session, but can not detect in javascript.
my javascript:
function DisplayConfirmation(cost,textboxid)
{
var s=document.getElementById(textboxid).value;
if(s>cost)
{
if(confirm('Are u sure'))
{
document.getElementById('<%=HiddenField1.ClientID%>').value = "true"
}
else
{
document.getElementById("<%=HiddenField1.ClientID%>").value = 'false'
}
}
else
{
}
}
my code in vb:
Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')")
End If
End Sub
the label and textbox can detect in javascript...
but if i use session, it can not detect in javascript. i don't know about the true code...
my code use session like this:
Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
Session("l") = l1
b.Attributes.Add("onclick", "return DisplayConfirmation(" & Session("l").tostring & ",'" & t2.ClientID & "')")
End If
End Sub
it can not detect...
what should i change it?
thx..
|
|
|
|
|
WTF?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Keep watching. I wouldn't get surprised if his next query would be how to create a web server in Internet Explorer and run a JavaScript webpage in IIS?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
try this in javascript
alert('<%=session("I")%>')
|
|
|
|
|
How can i iterate through and modify the data in databround rows of a ListView similar to a Gridview?
Here is the Gridview version:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim i As Integer
Dim Str As String
For i = 0 To Me.GridView1.Rows.Count - 1
Dim objUtil As New Utility
Dim s As String = Me.GridView1.Rows(i).Cells(1).Text
Str = objUtil.SQLdecode(s)
Me.GridView1.Rows(i).Cells(1).Text = Str
Next
End Sub
What would be the ListView version? The purpose as you can see is so I can use my sqldecode function to parse out the characters that represent apostrophe's.
|
|
|
|
|
vortex69306930 wrote: The purpose as you can see is so I can use my sqldecode function to parse out the characters that represent apostrophe's.
This is bad practice. It leaves your code open to SQL injection attacks. You should use stored procedures for all CRUD operations. Using stored procedures has the added advantage that you don't need to double up quotes in alphanumeric parameter values.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How can it be bad practice, my function disallows any sql injection attacks by pure nature by removing "'"'s. Observe:
<system.componentmodel.dataobjectmethodattribute _<br="" mode="hold"> (System.ComponentModel.DataObjectMethodType.Insert, True)> _
Public Function SQLencode(ByVal txt As String, Optional ByVal brEncode As Boolean = False) As String
If txt <> "" Then
Dim mySQL As String
mySQL = Replace(txt, "'", "")
If brEncode = True Then
mySQL = Replace(mySQL, vbCrLf, " ")
End If
SQLencode = mySQL
Else
SQLencode = ""
End If
End Function 'SQLencode
<system.componentmodel.dataobjectmethodattribute _<br="" mode="hold"> (System.ComponentModel.DataObjectMethodType.Insert, True)> _
Public Function SQLdecode(ByVal txt As String, Optional ByVal brToVbCrlf As Boolean = False) As String
If txt <> "" Then
Dim mySQL As String
mySQL = Replace(txt, "", "'")
If brToVbCrlf = True Then
mySQL = Replace(mySQL, " ", vbCrLf)
End If
SQLdecode = mySQL
Else
SQLdecode = ""
End If
End Function 'SQLdecode
Now do you think it's bad practice?
|
|
|
|
|
vortex69306930 wrote: Now do you think it's bad practice?
Yes. Of course it is. How does removing apostrophes prevent SQL injection attacks? I suggest you read up on the issue[^] and the consequences for your application.
BTW, your code is really ugly. As I previously mentioned, you can sidestep the whole problem by using parameterized stored procedures.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
Suppose I am running 3 websites on one client. They have different home pages. How server differentiate the 3 websites and also from where they can be accessible.
Thanks,
sjs4u
|
|
|
|