|
Hi,
I'm developing a web service in which I need to get the sub-directories & files list which reside in the same directory where the Web service is installed.
In other word, in the same directory where I put my Service.asmx, I have a few other files & directories.
Those file & Directories I need to access from within my Web Service Code.
This Web Service will be Deployed in a nother computer, so when I'm building it i have no idea in which directory it will reside.
My question is: How do I gain access to the actual directoy in which my Servive.asmx got installed to, so I could something like: foreach (string directory in Directory.GetDirectories(MyWebServiceDirectory))??
If i use Environment.CurrentDirectory I get the C:\Windows\system32...
If I use Application.StartupPath I get back a reference to an HttpApplicationState object...
p.s. I'm using C# .NET
Any Help is appreciated.
tnx
Roy Kabiri
|
|
|
|
|
Hi - In the little page below, which multiplies two numbers, how can I ensure that I get the "right" answer instead of some approximation? If, for example, I enter 79.32 in the first box and 10 in the second, instead of getting 793.2 I get 793.1999999999999
thanks.. Fred
<html>
<head>
<script language="javascript" >
<!--
function timesTB() {
var a = document.getElementById("tb1");
var b = document.getElementById("tb2");
var z = (parseFloat(a.value) * parseFloat(b.value)).toString();
document.getElementById("tbSum").value = z;
}
// -->
</script>
</head>
<body>
<form name="f1" action="">
<input type="text" id="tb1" onblur="timesTB()" value="1" >
<input type="text" id="tb2" onblur="timesTB()" value="1" >
<input type="text" id="tbSum" >
</form>
</body>
</html>
|
|
|
|
|
Fred_Smith wrote: If, for example, I enter 79.32 in the first box and 10 in the second, instead of getting 793.2 I get 793.1999999999999
That is completely normal. Floating point math is never exact.
Most values can not be exactly represented, so the closest approximation is used. When you multiply the values, the rounding errors get large enough to show up when you convert the value to it's string representation.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks.. it may be normal but it's still wrong! Is there not a simple way to get and display the correct answer?
cheers, Fred
|
|
|
|
|
You can't display the "correct" answer, as it doesn't exist...
Use the Math.round method to round the value to the precision you want to display.
---
single minded; short sighted; long gone;
|
|
|
|
|
No disrespect Guffa (believe me, I have great respect for the efforts you put into this forum) but there is a correct answer: the correct answer to 79.32 * 10 is 793.2, plain and simple, and it seems crazy to have to jump through all sorts of hoops to arrive at it using Javascript.....
Thanks anyway...
F
|
|
|
|
|
Yes, theoretically the correct answer exists, but in the Javascript it doesn't.
---
single minded; short sighted; long gone;
|
|
|
|
|
hi...
Does anybody know if there`s a limit to the form post method?
I`m trying to pass some values (form input hidden/text and select fields) through ASPX pages, but my Request.Form collection isn`t complete on the receiving page - it only has the firsts elements in my form. The page that passes the values is only a html page with the .aspx extension - it doesn`t contain anything ASPX related.
I`m using .NET 2.0 with VS2005 and IE6 and FF 2.0.
Also, i have read some hints on the internet without any help (changing the reg. [B]MaxClientRequestBuffer [/B]value or putting the ENCTYPE="multipart/form-data" into the sending form tag)
thanks in advance...
|
|
|
|
|
Try the ASP.NET forum... oh you did... don't cross post.
led mike
|
|
|
|
|
have an asp page with many frames in it.how can i set the scroll to yes.the page is content is long,so i need a scroll,how to set it,and where?
i tried
but
its not showing it when i am viewing the page,in a browser
wat can i do,i tried :scrollbar="yes"but nothing
wat can i do
|
|
|
|
|
Hi I am trying to get a web app setup on a laptop and have .Net Framework, SQL Server 2000 and IIS installed but when u try to view the Default.aspx in the browser only the html code is displayed on the page and no controls are created if anyone has any ideas why this is happenin I would really appreciate any help
Thanks in advance
Tim
|
|
|
|
|
You set up the website in iis? I would guess that some of the properties in IIS for the site are wrong. You are trying to access the site through a url correct? If you try to just double click on the default.aspx file it won't automatically open in a browser.
Ben
|
|
|
|
|
kubben wrote: You set up the website in iis? I would guess that some of the properties in IIS for the site are wrong. You are trying to access the site through a url correct? If you try to just double click on the default.aspx file it won't automatically open in a browser.
correct on all counts
|
|
|
|
|
So if you go into IIS and go to the web site you set up. In that directory in iis if you right click on your default.aspx file what happens? Another question is are you missing some files. Like is the bin directory with all the dll's in the site?
Ben
|
|
|
|
|
I am trying to implement an ActiveX control given to me by a hardware developer for their equipment. I am new to Java/XML and really can't figure out the correct function/syntax to get this working. This is a snip of the VB code that gets the readings from the ActiveX control called "Temp":
<br />
rval = Temp.GetReadings(sngTemperature, lngTemperatureError, sngTemperature2, lngTemperature2Error, sngDewpoint, lngDewpointError)<br />
if rval = 0 Then<br />
data = sngTemperature<br />
I need the "data" value. If I change the code to "data = sngTemperature2" then I get a different value from the control. I'm not having much luck with this so any help or advice would be appreciated!
Thanks much!!
|
|
|
|
|
Thanks for the reply.
I know this is a difficult problem, and there is probably no 100% secure solution. But, it is very bad practise to rely on confusion to secure something like this. Seems like thats the only way though.
|
|
|
|
|
Well, it is not necessaryly a bad practice. For instance if you are familar with serialization. It is pretty easy to serialize an object (class) and pass that in as a parameter. If you happen to have lots of parameters to pass that would be a good idea. If you know your web method depends on an object being passed back and forth it makes your custom web service pretty custom. Could someone figure out the class you are passing back and forth, maybe, but it might be more work then it is worth. Sometimes that is what you have to do. Make it more work then someone is willing to go through. If you didn't want to pass a serialized class as the parameter you can easily pass a dataset. So you could have one table with one row and the row would have the columns that would match to the parameters for that webmethod call. A little less work, but a little easier for you if you are not as familar with serialization.
Hope that helps.
Ben
|
|
|
|
|
I have a update panel on my page.
There is a asp:button in my panel.
On the click of that button, I want to register a StartupScript for the page. So as when the page renders again, that script gets executed.
But I am not able to execute the startupscript on partial page rendering.
the same works fine if the button is out of update panel.
I think this is because, during partial page rendering Load of body is not being called. and so, the script is not getting executed.
Please suggest the way to register such startupscript for the AJAX enabled page.
Thank you,
|
|
|
|
|
Hi All,
I have developed an FTP client. When I try to download some of the files I get the error "dst_dataconn ended unexpectedly" with error code 550. Does any one know why this error pops.
Sri
|
|
|
|
|
That is the access denied error code. You may have a problem...
Brad
Australian
- Me on "Public interest"
If you actually read this let me know.
|
|
|
|
|
Thank you.
I was able to solve that problem. My socket was time based(timeout) and not databased. I had to make some correction in the code so that it recevies the data till the last byte.
Sri
|
|
|
|
|
Hi.
I have a webservice - and I want to make sure that only MY application is using it.
Is this possible, in a secure way?
Thanks,
Cormac
|
|
|
|
|
It helps if your webservice isn't exposed at all. That means get rid of all disco file on your web server.
In your web.config you can add this code:
<webServices>
<protocols>
<remove name="HttpPost" />
<remove name="HttpGet" />
</protocols>
</webServices>
That causes your webservice to only allow soap protocols. This means if you access your asmx file you would see links you can click.
Finally, you could have your application pass some sort of key into each request. Of course, if you don't use ssl the data could always be read. I think if you webservice isn't exposed through disco files and it rejects http protocol you probably have 90%. To go the whole way you would have to have ssl and some sort of key.
Hope that helps.
Ben
|
|
|
|
|
That's a good idea, I never thought of removing the WSDL!
I am already using a username/password type of authentication, which I made myself, and it will be operating over SSL also.
But, I am worried that there is a possiblity of my users creating their OWN application, and utilising the web service (with their own credentials), which would not implement the logic based in my client application, and therefore wreak havoc.
"To go the whole way you would have to have ssl and some sort of key."
Even then, hard coding a key into a .NET app is really dodgy - too easy to decompile.
Maybe I'm being too cautious?
Regards,
Cormac Redmond
|
|
|
|
|
When I am talking about a key I am talking about using a private key for signing. If you are already planning on using a username and password along with ssl I think all you need to do is remove the ability of non users to see your webservice.
Ben
|
|
|
|