|
I am trying to use the following code to ping GoogleBlog but it is taking FOREEEEVER to load. Can anyone see any issue with the code that may be causing it to run so incredibly slow? I am at my wits end with this now so any help appreciated.
Thank
------pingblog.aspx----------
<title>Untitled Page
<asp:button id="Button1" runat="server" text="Button">
<asp:label id="lb_display" runat="server" text="">
Hello world
-------pingmyblog.vb------------
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Xml
Public Class _pingmyblog
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write(Send())
End Sub
Function Send()
Dim listToPing As New ArrayList
Dim pingURL As String = ""
Dim blogURL As String = "http://www.eyeonspain.com/blogs/lisa.aspx"
Dim blogName As String = "Confessions of a Property Manager"
Dim blogFeed As String = "http://www.eyeonspain.com/blogs/feeds/lisa.xml"
With listToPing
.Add("http://blogsearch.google.com/ping/RPC2")
End With
Dim ok As String = ""
Dim NG As String = ""
Try
pingURL = listToPing.Item(i).ToString
Dim technoratiPing As HttpWebRequest = CType(WebRequest.Create(pingURL), HttpWebRequest)
technoratiPing.Method = "POST"
technoratiPing.ContentType = "text/xml"
Dim streamPingRequest As Stream = CType(technoratiPing.GetRequestStream, Stream)
Dim xmlPing As XmlTextWriter = New XmlTextWriter(streamPingRequest, System.Text.Encoding.UTF8)
xmlPing.Formatting = Formatting.Indented
xmlPing.WriteStartDocument()
xmlPing.WriteStartElement("methodCall")
xmlPing.WriteElementString("methodName", "weblogUpdates.ping")
xmlPing.WriteStartElement("params")
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogName)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogURL)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogURL)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogFeed)
xmlPing.WriteEndElement()
xmlPing.WriteEndElement()
xmlPing.WriteEndElement()
xmlPing.WriteEndDocument()
xmlPing.Flush()
Dim technoratiPingResponse As HttpWebResponse = CType(technoratiPing.GetResponse, HttpWebResponse)
Dim streamPingResponse As StreamReader = New StreamReader(technoratiPingResponse.GetResponseStream)
Dim strResult As String = streamPingResponse.ReadToEnd
streamPingResponse.Close()
technoratiPingResponse.Close()
ok = ok & strResult & " "
Catch ex As Exception
'Add code here to flag a service as broken
NG = NG & CStr(i) & " "
End Try
Next
Return "OK = " & ok & " " & "NG = " & NG
End Function
End Class
|
|
|
|
|
I have solved this now.
It's because I missed out "xmlPing.Close()"
Just thought I'd update this if anyone ever needs the code.
|
|
|
|
|
Hi all,
how to Bind the Custom Validator control to GridView Control.
please explain with example.
thanks in advance.
Jack
|
|
|
|
|
Do you mean you have a template field and you want to put a required validator on that?
|
|
|
|
|
yes, i have Template field,and item template, in item template, i have to keep "Custom Validator ", please explain me, with example.
Jack
|
|
|
|
|
Hi
I am displaying a password field which is part of the login control
However when I start typing in it, it is not showing the text being typed. Normally a circle appears in the textbox for each letter but for mine it is not displaying any text.
The text is still being entered as when I hit enter the page logs in and matches the password.
If any1 knows why this would let me know!
cheers!
|
|
|
|
|
Strange. Looks like some CSS issue. If you have applied CSS to the control, try removing it.
|
|
|
|
|
Your right it is sort of a css issue
Basically I'm including a skin in the page and I have the below code in it:
<asp:Textbox runat="server"
ForeColor="Black"
Font-Names="HelveticaNeueLT Std,Arial,Times New Roman,Verdana"
Font-Size="10pt"/>
but when I change Font-names to Font-family all the text is displayed in the wrong font
Is there something I can add in the above code so that it allows visible typing into a password box?
thanks!
|
|
|
|
|
sorted it
I gave the control an ID in the skin and then applied the ID to the password textbox
cheers!
|
|
|
|
|
|
It's the first time I'm dealing with programming a web service. I want to write a method that allows the client to download some files. I created a new folder called 'myFiles' in the Web Service solution.
The web method is this:
[WebMethod]
public byte[] downloadFile()
{
FileStream fs = new FileStream("myFiles\\aaa.txt", FileMode.Open);
byte[] contents = new byte[fs.Length];
fs.Read(contents, 0, (int)fs.Length);
return contents;
}
When I test the function, I get the error:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\myFiles\aaa.xls'.
Why is it looking fot the myFiles folder there. How do I point it to the local folder of the web service application?
Thanks.
|
|
|
|
|
Use Server.MapPath()
[WebMethod]
public byte[] downloadFile()
{
FileStream fs = new FileStream(Server.MapPath(@"myFiles/aaa.txt"), FileMode.Open);
byte[] contents = new byte[fs.Length];
fs.Read(contents, 0, (int)fs.Length);
return contents;
} myFiles directory should be in the root of WS. Make sure you are closing stream after reading.
|
|
|
|
|
|
I filled DataSet use SqlCommand.
then DetailsView bind dataSet:
DetailsView.DAtaSource = DataSet;
DetailsView.DataMember = "table1";
DetailsView.DataBind();
then AllowPaging. but when running, report:
incident the untreated event,PageIndexChanging.
if use SourceDataControl Bind, navigation page is succeed.
why unsuccessfully with first way?
how do can navigation page succeed?
|
|
|
|
|
In your aspx in the DetailView part you add
OnPageIndexChanging="dv_PageIndexChanging"
in your code behind you add:
protected void dv_PageIndexChanging(Object Sender, DetailsViewPageEventArgs e)
{
LoadDetailView(e.NewPageIndex);
}
protected void LoadDetailView(Int32 pageNumber)
{
DetailsView.DataSource = DataSet;
DetailsView.DataMember = "table1";
DetailsView.Page = pageNumber;
DetailsView.DataBind();
}
may the force be with you
|
|
|
|
|
Hi Friends,
I am having a multiline text box which contains all details,another textbox is available which i have entered a word and click a find button it should highlight a particular word in a richtextbox like Find and Replace in windows.Can anyone help me how to do in javascript.
Thanks in Advance
modified on Friday, May 23, 2008 3:48 AM
|
|
|
|
|
Check this out:
Its in asp.net but this is a .net forum so maybe you could try it:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=146&AspxAutoDetectCookieSupport=1
|
|
|
|
|
Hi,
Sorry the details are displayed in textbox ie multiline textbox.Can you please tell me how to do.
Thanks In Advance
|
|
|
|
|
how to replace and trim particular part from string.
string s = '2,5,7,8,9'
now I want to trim ',8' from s
and replace 7 by 15
finally it will be
s='2,5,15,9'
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
By trim, you mean replace ,8 with string.Empty. Trimming refers to removing whitespace from the edges.
The string class has a replace method.
This is totally unrelated to ASP.NET.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What this has to do with ASP.NET ? Trimming means removing whitespace and not removing a character. string has a Remove() method, check that. BTW, you could try something like this too
s.Replace("7", "15").Replace("8,", string.Empty)
|
|
|
|
|
thanks a lot
You get the best out of others when you give the best of yourself.
|
|
|
|
|
string s = "2,3,7,8,22,8";
now I want to check
string has 22 or not
22 should be treated as a string not character.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
bool exist = s.IndexOf("22") >= 0 ? true :false;
if(exist)
{
//The string exist.
}
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Hello Friend iam new to asp.net
i have a problem here iam using datalist control in this control i have image and chek box if user un chek chekbox mean he don't want to diplay image then i need to disable image how to write inlinecode for this
i will try both ways like inlinecode and itemdatabound event
if i go with item databound problem is it it's not disable first iamge in datalist remaining images are disabled except first one
here is my code
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
CheckBox lblimge = (CheckBox)e.Item.FindControl("chkid");
HtmlTableCell TAB = (HtmlTableCell)e.Item.FindControl("TDIamge");
DLNews.ItemDataBound =
foreach (DataListItem di in DLNews.Items)
{
if (lblimge.Checked == false)
{
TAB.Visible = false;
}
else
{
TAB.Visible = true;
}
}
}
|
|
|
|