|
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
|
|
|
|
|
sjs4u wrote: How server differentiate the 3 websites
The websites would exist in separate virtual directories in IIS.
sjs4u wrote: and also from where they can be accessible
What do you mean?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
sjs4u wrote:
and also from where they can be accessible
What do you mean?
If we want to access perticular website then how can we know?
whether by ip address or
domain name? or
anything something different.
Thanks,
sjs4u
|
|
|
|
|
sjs4u wrote: If we want to access perticular website then how can we know?
whether by ip address or
domain name? or
anything something different.
I have no idea what you are saying.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
sjs4u wrote: whether by ip address or
domain name? or
anything something different.
When you type a domain name, the DNS server (often shortly called as Name Server) looks up its associated IP Address and gives it to your web browser. YOur browser or its associated Proxy server (on your browser's behalf) initiates a HTTP or HTTPS (SSL/TLS) connection with the server. This goes through a number of hops like your ISP, Caching servers etc. But I hope, this can give you a quick insight into what is going on in the background.
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
|
|
|
|
|
So you have multiple Web sites running on your server. One way to do it is to just use different ports. The default port is 80. So if you type www.mywebsite.com:80 is the same thing as www.mywebsite.com. You can add a website in IIS at port 81 so you would type www.mywebsite.com:81.
That is not really a good way to do it since most users will never type the 81. A better way is to give each site it's own IP. So you need to give you server multiple IP's. The assign each individual IP to the website in IIS. You can then DNS each IP to a different name like web1.mywebsite.com and web2.mywebsite.com.
|
|
|
|