|
|
This looks kind of trivial. Do you not know any ASP.NET ?
Looks like you can send an SMS by passing it on the URL to this site. So, the first part is just building a string, use a stringbuilder for that.
The second part, you just do a send and see if the response is <success> I think the classes are called HTTPRequest and HTTPResponse.
This is not ASP.NET code, it's just C# code that makes a HTTP request. Doing an ASP.NET page that takes the details to post, is more than can be done in a forum reply, and also trivial.
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 )
|
|
|
|
|
thanks...
but i have problem with httprequest or httpresponse
its not working..
Error 8 'System.Web.HttpResponse' is a 'type' but is used like a 'variable'
|
|
|
|
|
I guess if you posted the code, I would be able to correct it.
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 )
|
|
|
|
|
// the problem is her...
gv_reply = httpRequest(gv_url);
if (gv_reply == "<lt;succes>>")
{
' If the reply contains the tag <succes> the SMS has been sent.
Response.Write "The message has been sent. Server response: " & gv_reply
}
else
' If not, there has been an error.
Response.Write "The message has NOT been sent. Server response: " & gv_reply
//To here..
|
|
|
|
|
Burim Rama wrote: gv_reply = httpRequest(gv_url);
What is httpRequest ? What made you think this would work ?
Try this:
http://en.csharp-online.net/HTTP_Post[^]
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 )
|
|
|
|
|
i need to se if my rquest from the page is succses like a posted the first topic in php .. thanks christian.
|
|
|
|
|
That's why you do the post of the data and grab the response.
Here is the code from my credit card class, which uses the methods you need to use.
string strPost = transaction.ToString();
StreamWriter myWriter = null;
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create((transaction.TestRequest) ? testurl : url);
objRequest.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequired;
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception e)
{
return null;
}
finally
{
if (myWriter != null)
myWriter.Close();
}
string result = string.Empty;
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
AuthorizeResponse response = new AuthorizeResponse(result);
return response;
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 )
|
|
|
|
|
I took over a project and found usercontrols in
the App_Code-directory, now I was wondering, why
put them in App_Code and not just anywhere else.
The only reason I could find was if it was a base-class
and I want other controls to inherit from it.
But if it's just a control that let say shows a logo
with some text, why would I put that control in App_Code
|
|
|
|
|
If it's in app code, it must be a control entirely in code, no markup. That would then be where it belongs
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 )
|
|
|
|
|
So as soon as I'm creating a control that uses hyperlink, textbox and so on, It should not be in App_Code.
I found a UserControl with this method in it:
public override void RenderControl(System.Web.UI.HtmlTextWriter writer) <br />
{<br />
writer.Write("<p><a href="\"/about.aspx\"">" + this.Language[0] + "</a>|<a href="\"/advertise.aspx\"">" + this.Language[1] + "</a>|<a href="\"/contact.aspx\"">" + this.Language[2] + "</a></p>");<br />
}
This feels wrong to me, I would have put it in a normal usercontrol outside App_code and used hyperlinks instead.
|
|
|
|
|
If it's code, not a control with an ascx, the App_Code is the only place for it unless you put it in a dll. Otherwise, it's not going to be compiled.
If the person who worked on it before made good choices in what to use, is a different question, that much is true.
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 )
|
|
|
|
|
So I should only create a usercontrol in App_Code if I have a good reason for it?
I just can't figure out what that good reason is...
|
|
|
|
|
I would tend to put them in a dll for reuse, if I wrote any,
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 )
|
|
|
|
|
Absolutely, I would do that to if I were to reuse them.
Could the be any benefits like loading-speed or something if I put the usercontrols in app_code rather than outside?
|
|
|
|
|
None I can think of. They only get loaded the first time a page gets accessed, then they live in server memory
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 )
|
|
|
|
|
Yeah, that's what I thought, I just keep the usercontrols out of app_code until I find a good reason to to otherwise.
Thanks Christian...
|
|
|
|
|
Hi
Does anyone know any good articles for creating a keyword search in c#?
Ive found loads which show you how to search through a database driven website but all the content on my website that I need to search for is not database driven
any help would be great!
thanks
|
|
|
|
|
If it's not database driven, your best bet is to use google to search your site, if it's live. If it's not, then you need to build a DB.
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 )
|
|
|
|
|
OK
Basically Im building a web app which will have lots of links and text information displayed on pages. So the text information which is not stored in the database can only be searched using google and not a custom search engine I build myself as it would take too long, is that what you mean?
I was hoping to find some example code on how to create my own search engine but I dont want to spend months doing it.
thansk for the reply
|
|
|
|
|
.netman wrote: I was hoping to find some example code on how to create my own search engine but I dont want to spend months doing it.
Every search engine, including Google, is based on databases and indexes. The better the indexing, the quicker the searches. That's what a database is good for, there's really no alternative. If your pages are static, you could choose to put the content into a DB, and search from there, that shouldn't take too long. It depends on how complex a search you want to support. IF your site is live, then there is no better option IMO than doing a google search from your site with site: yourURL as part of the search string.
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 )
|
|
|
|
|
Thanks for the reply.
The app is not live yet so it may be worth putting the content in a database and then just using queries to search the data. I think I will do that.
cheers
|
|
|
|
|
Take a look at the Searcharoo project here[^]
|
|
|
|
|
Hi
thanks for the reply
This is not quite what I want though
cheers anyway
|
|
|
|
|
i have a master page n a content page..in content page i have a datalist and two button....while running this it trows an exception "Control 'ctl00_ContentPlaceHolder1_btnPrev' of type 'Button' must be placed inside a form tag with runat=server." so i add the code in content page's load event
System.IO.StringWriter stringwriter = new System.IO.StringWriter();<br />
System.Web.UI.HtmlTextWriter htmlwriter = new System.Web.UI.HtmlTextWriter(stringwriter);<br />
this.pnl1.RenderControl(htmlwriter);<br />
string s = stringwriter.ToString();<br />
public override void VerifyRenderingInServerForm(Control control)<br />
{<br />
return;<br />
}<br />
EnableEventValidation="false"....now its working but the problem is this..the click-event of the buttons of content page are not working...please someone help
|
|
|
|