|
On the client side within the web service proxy class you can override the WebRequest() method to get the returned data size. No need to save the contents to disk.
1) Before the client invokes, save the time.
2) In public override WebRequest(..) save the data size (on request and response)
3) When the invoke returns save the time and calc the differences.
Good Luck.
-John
|
|
|
|
|
Thanks
where can override this method?
i have the web service as a web reference (visual studio) within my client
thanks again for your help
Colin
|
|
|
|
|
One approach:
Right-click on the reference to the web service.
View in Object Browser
Browse to the class object for the web service.
Right-click Go To Definition
type:
protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request)<br />
{<br />
return base.GetWebResponse (request);<br />
}
Just remember, if you "Update Web Reference" any code you've created will be overwritten.
-John
|
|
|
|
|
Thanks John, im learning a lot here!
as im overriding this method do i have to explicitly call it, or would i have to do this anyway?
For my problem where/how do i call this and what type do i save the return as?
Thanks
Colin
|
|
|
|
|
Colin,
Here's the basic override code. I write a static function called Logger() to write the info to a textbox; you'd want to probably write to a text file or database. For some reason the response length is -1 if you get it off the object itself. You can get the response length if you read the entire stream like I've done. This is all BEFORE deserialization so you're timing will be off a bit.
You don't have to explicitly call anything. These are base methods you're overriding and the proxy is taking care of calling them for you.
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
PersonClient.Form1.Logger("startTime=" + System.DateTime.Now);
return base.GetWebRequest (uri);
}
protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request)
{
System.IO.StreamReader sr = new System.IO.StreamReader(request.GetResponse().GetResponseStream());
string buffer = sr.ReadToEnd();
sr.Close();
PersonClient.Form1.Logger("ReqLen=" + request.ContentLength);
//request.GetResponse().GetResponseStream().Length;
PersonClient.Form1.Logger("ResLen=" + buffer.Length );
PersonClient.Form1.Logger("endTime=" + System.DateTime.Now);
return base.GetWebResponse (request);
}
-John
|
|
|
|
|
thanks John ill give it a try
Colin
|
|
|
|
|
John
I created a public Void Logger(string strIn)
which saves the string to a database
How can i get access to this from the GetWebResponse method?
I tried WebForm1.Logger("Length" + request.ContentLength)
but i get an error
would it be possible to e-mail your sample application to me?
cm@gowcity.fsnet.co.uk
Thanks a lot
Colin
|
|
|
|
|
Hi,
i'm a .NET newbie and hope someone can help me. I try to build something like an applet (Java) with C# and .NET. I've been told this can be done by a windows forms control assembly embedded in a html page via the well known <object> tag. Indeed, everything works fine except the control's database access to a local database. Here i get the exception "SQLClientPermission denied". I'm sure the problem lies in the CLR access policies for the code of the embedded control (coming from the intranet zone). Can anyone tell me how to grant this SQLClientPermission to the code of my control?
Thanks for your help,
Fridtjof
|
|
|
|
|
|
This is what I do to prevent duplicates on my site (non-cart oriented)
1) Create a field in the table that stores a unique id with each submitted item. Create a unique index on the field.
2) Generate a unique id (if you're using php, generate an md5 digest, and use the first 10 or so chars) when the form is displayed, and store its value in a hidden input field in the form
3) When the form is submitted, add the unique id to the table along with the rest of the data. If the user goes back and hits submit again or hits refresh, reinserting the unique id will bring up a duplicate key error, which you can interpret as "you've already submitted your data".
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
I think ur basic purpose is that user should not be able to submit twice.
Now if that is the case then in the db table with which the forms fields are concerend(In which submit button is) u can have a field status which can have two values(Yes, No).When form is submitted then status value should be Yes otherwise No.
On every submission u can check the value of status by a query.If it is Yes then U can show an error msg otherwise can accept the values.
I hope this will serve ur purpose.
|
|
|
|
|
how do i set a button as default in a webform. when my users press enter i want my submit button to happen right now my reset buttons happens
thanks
chad
|
|
|
|
|
// C#
private void SetDefault(Button myDefaultBtn)
{
this.AcceptButton = myDefaultBtn;
}
The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!
|
|
|
|
|
May i know who have solution for my current problem when using Microsoft Multimedia Control 6.0 activeX control in VBSCRIPTS in HTML Page.
Problem :
I make a simple html page which having Multimedia Control.
The formated harddisk installed with WINXP without Visual Studio installed,
successful download the [Microsoft Multimedia Control, version 6.0] into
c:\Windows\Downloaded Program Files.
However, when open that HTML page with that control, it not able to load the control successful.
The same HTML file, i already tested on other pcs without any problem.
(Note: Others pcs have Visual Studio 6.0 Pro installed)
Wish anyone who know the way to solved my problem.
Code :
<object classid="clsid:C1A8AF25-1257-101B-8FB0-0020AF039CA3"
codebase="http://activex.microsoft.com/controls/vb6/MCI32.CAB"
height="50" width="400" id="MMControl1">
|
|
|
|
|
I want to create a javascript tha achoieves the fullowing functions
1. when page loads it shows images from random locations
2. Whenever the user click the mouse anywhere on the browser the images should be hidden
3. After some time duration diaplay the images again
here is my code
<html>
<body>
<script language="JavaScript1.2">
<!--
Cupid=new Image();
loaded =true;
Cupid.src="bat.gif"; //specify path to bat image
amount=3; //Number of cupids, minimum must be 3.
Xpos=700; //cupids x coordinates, in pixel
Ypos=200; //cupids y coordinates, in pixel
step=0.3; //Animation speed (smaller is slower)
dismissafter=15; //seconds after which Cupids should disappear, in seconds
yBase=xBase=currStep=a_count=0;
flycupid=0;
b_count=1;
c_count=2;
d_count=3;
move=1;
var ns6=document.getElementById&&!document.all
bats=new Array(3)
if (document.layers){
//alert('start in if1');
for (i=0; i < amount; i++)
{
document.write("<LAYER NAME=n"+i+" LEFT=0 TOP=-50><a href='http://www.dynamicdrive.com'><IMG SRC='"+Cupid.src+"' NAME='nsi' width=69 height=60 border=0></a></LAYER>")}
}
else if (document.all||ns6)
{
document.write('<div id="out" style="position:absolute;top ;left "><div id="in" style="position:relative">');
for (i=0; i < amount; i++)
{
if (document.all)
{
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="msieBats" style="position:absolute;top:-50;left " border=0></a>')
//alert('start in if2');
}
else
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="ns6Bats'+i+'" width=69 height=60 style="position:absolute;top:-50;left " border=0></a>')
}
document.write('</div></div>');
}
if (document.layers||ns6)
{
//alert('start in if3');
yBase=window.innerHeight/3;
xBase=window.innerWidth/6;
if (document.layers)
window.captureEvents(Event.MOUSEMOVE);
}
if (document.all)
{
yBase = window.document.body.offsetHeight/3;
xBase = window.document.body.offsetWidth/6;
}
if (document.layers)
{
for (i=0; i < amount; i++)
document.layers['n'+i].document.images['nsi'].src=Cupid.src
}
else if (document.all)
{
for (i=0; i < amount; i++)
{
document.all.msieBats[i].src=Cupid.src
//alert('start in if6');
}
}
else if (ns6)
{
for (i=0; i < amount; i++)
document.getElementById("ns6Bats"+i).src=Cupid.src
}
function dismisscupid()
{
clearInterval(flycupid)
if (document.layers)
{
for (i2=0; i2 < amount; i2++)
{
document.layers['n'+i2].visibility="hide"
}
}
else if (document.all)
document.all.out.style.visibility="hidden"
else if (ns6)
document.getElementById("out").style.visibility="hidden"
}
function cleanUP()
{
Cupid=new Image();
Cupid.src="bat.gif"; //specify path to bat image
amount=3; //Number of cupids, minimum must be 3.
Xpos=700; //cupids x coordinates, in pixel
Ypos=200; //cupids y coordinates, in pixel
step=0.3; //Animation speed (smaller is slower)
dismissafter=15; //seconds after which Cupids should disappear, in seconds
yBase=xBase=currStep=a_count=0;
flycupid=0;
b_count=1;
c_count=2;
d_count=3;
move=1;
var ns6=document.getElementById&&!document.all
bats=new Array(3)
if (document.layers){
for (i=0; i < amount; i++)
{
document.write("<LAYER NAME=m"+i+" LEFT=0 TOP=-50><a href='http://www.dynamicdrive.com'><IMG SRC='"+Cupid.src+"' NAME='nsi' width=69 height=60 border=0></a></LAYER>")}
}
else if (document.all||ns6)
{
document.write('<div id="out" style="position:absolute;top ;left "><div id="in" style="position:relative">');
for (i=0; i < amount; i++)
{
if (document.all)
{
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="msieBats" style="position:absolute;top:-50;left " border=0></a>')
}
else
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="ns6Bats'+i+'" width=69 height=60 style="position:absolute;top:-50;left " border=0></a>')
}
document.write('</div></div>');
}
if (document.layers||ns6)
{
yBase=window.innerHeight/3;
xBase=window.innerWidth/6;
if (document.layers)
window.captureEvents(Event.MOUSEMOVE);
}
if (document.all)
{
yBase = window.document.body.offsetHeight/3;
xBase = window.document.body.offsetWidth/6;
}
if (document.layers)
{
for (i=0; i < amount; i++)
document.layers['m'+i].document.images['nsi'].src=Cupid.src
}
else if (document.all)
{
for (i=0; i < amount; i++)
{
document.all.msieBats[i].src=Cupid.src
//alert('start in if6');
}
}
else if (ns6)
{
for (i=0; i < amount; i++)
document.getElementById("ns6Bats"+i).src=Cupid.src
}
}
//
function Animate()
{
a_count+=move;
b_count+=move;
c_count+=move;
currStep+=step;
if (a_count >= bats.length) a_count=0;
if (b_count >= bats.length) b_count=0;
if (c_count >= bats.length) c_count=0;
if (document.layers)
{
for (i=0; i < amount; i++)
{
var NewL="n"+i
document.layers[NewL].top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.layers[NewL].left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}
if (document.all){
for (i=0; i < amount; i++)
{
document.all.msieBats[i].style.pixelTop = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.all.msieBats[i].style.pixelLeft =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}
if (ns6)
{
for (i=0; i < amount; i++)
{
document.getElementById("ns6Bats"+i).style.top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.getElementById("ns6Bats"+i).style.left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}
}
function moveToClick(evt) {
loaded =false;
evt = (evt) ? evt : event;
dismisscupid();
//cleanUP();
flycupid=setInterval('Animate()',30);
}
function startup() {
flycupid=setInterval('Animate()',30);
//dismisscupid
//setTimeout("dismisscupid()",3*1000);
}
window.onload = startup;
document.onmousedown = moveToClick;
//-->
</script>
</body>
</html>
but this doesn'tachieve the 3rd funcion.Can anybody tell me wht's wrong with this script.
|
|
|
|
|
Who can help me answer this question? ;PThanks!
|
|
|
|
|
|
NO.
You can access the varibales of the other form using javascript but action will take your page to only one url.
Code below:
Here u will be redirted to test1.html
|
|
|
|
|
So, you mean each HTML page can have one or more forms, but more than one form can not be submitted at one time, right?
Thank you, man!
|
|
|
|
|
|
Hi,
i want to embed a signed windows forms control (assembly with strong name, using a .snk key pair) into a html page. Using the normal <object>-tag works fine with the unsigned control, but doesn't work with the signed one! The signed control doesn't even open! In both cases i used the same html code. Is there information missing (e.g. about the key pair)?
Thanks a lot for your help!
Fridtjof
|
|
|
|
|
Hi,
here some additional informations:
1. I used sn -k key.snk for generating the key pair.
2. Then I used an attribute in the AssembyInfo.cs file to sign the control:
[assembly: AssemblyKeyFile("key.snk")]
3. In the html page the code
<object id="A" classid="http:ALib.dll#ALib.MyACtl"
width="568" height="416">
</object>
worked fine with the unsigned control. I used exactly the same code with the encrypted control. It seems to me that Internet Explorer cannot find the class "ALib.MyACtl" any more. Maybe since it is encrypted now???
Thanks for any advice,
Fridtjof
|
|
|
|
|
hai,
I'm new to asp...and i'm using javascript.I am developing a webpage where it has some list boxes..and the user has to select the values from the list boxes..when the user goes to the next page i want to set the user selection to session variables and display them...I'm getting the selections using form and Request.Form("..")..i want to know howto set these as session variables..
thanks a lot.
|
|
|
|
|
<%
Session("name") = Request.Form("name")
Session("surname")= Request.Form("surname")
%>
--junior coder--
|
|
|
|
|
I am developing a website that uses the same images on some secure and unsecure pages. I know I can't keep the secure images in the cache so I have to load them every time I link to a new secure page. I have a javascript that loads the images in the head section of the secure pages. It seems to work on Internet Explorer on Windows but other browsers/platforms are only displaying the first image. Does anyone know what might cause this problem?
Also, is anyone aware of a better way to keep secure images around(i.e. in the cache) or a way of tricking the browser into thinking that my previously cached unsecure images are actually secure, without getting the annoying popups about secure and unsecure items.
dzs
|
|
|
|