|
I have a case where I have a db with the active directory user names and the CN entry from thier certificates. I have searched all over but cannot find anyway to do this. I need to extract the certificate information and the code to add it into IIS progromatically on a 1-to-1 basis or the code to add an entry to create a CN mapping to thr user name using a many-to-one basis. This works manually but I have to many accounts to do this manually. If antone has any suggestions and code samples I would be thankful. Please e-mail me at bmores@eciii.com with any suggestions.
|
|
|
|
|
Hi, guys.
Its the question. How can i get page, which need authorization(using known username and password). For example, how to get my new messages in FaceBook? I can parse it of course to get exactly what I need, but how can I get it?
Sorry, if it's stupid question. I'm just learning. Thanx.
|
|
|
|
|
Write a screen scraper that sends a HTTP POST request to the site. The POST request should contain the user's login details. You would need to know how the login form submission works on the site, i.e. what the format of the POST request should be. You can then scrape the HTTP response to get your messages.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Me again.
I have a strange problem with StatusCode.
I want to simulate a '500 Internal Server Error' by setting Response.StatusCode equal to 500, but it doesn't seem to work.
I've turned on trace, page renders properly, but the Status code in trace is 500.
I even turned on custom errors in web.config, but Response.Status = 500 doesn't make ASP to redirect to a page inside web.config, but when I misspelled a URL, ASP redirects me to a 404 error page.
Can anyone tell me how to simulate page status like that error really happened?
Thank you so much!
|
|
|
|
|
It's early in the morning here, so I apologise if this seems a bit muddled, but you could probably simulate this using an HttpHandler. In fact, thinking about it, this would probably be the best way to do this.
|
|
|
|
|
Thank for your reply, but could you give me any example how can I do this?
I don't quite understand how can I simulate 500 internal server error with HttpHandler?
On the other hand, I do use HttpHandler for captcha.
Sorry for late reply. I had some issues with logging on Code Project.
|
|
|
|
|
Kasic - if you take a look at my blog here[^] you should find the answer.
|
|
|
|
|
I did take a look, but this post is written today .
I was few days ago on your blog .
Anyway, thank you for your help.
|
|
|
|
|
How to create standalone web service (if that is the right term) that is resident in memory and running all the time? I mean I dont need url for it , start page adn of course no interaction.. I mean I dont want to invoke any function or call WS in another app, just want to have it running all the time.
WS will check some web site for some word and inform me by email when it appears.
Regards,
Jalle
modified on Friday, February 29, 2008 3:43 PM
|
|
|
|
|
What you're asking for is called a Windows Service
only two letters away from being an asset
|
|
|
|
|
OK great thank you.
I made windows service and add following code
<br />
Imports System.Net.Mail<br />
Public Class Service1<br />
<br />
Protected Overrides Sub OnStart(ByVal args() As String)<br />
Debug.Print("sending")<br />
SendEmail("test", "jaskotr@yahoo.com") <br />
End Sub<br />
<br />
Protected Overrides Sub OnStop()<br />
' Add code here to perform any tear-down necessary to stop your service.<br />
End Sub<br />
<br />
End Class
And press F6 but nothing happens , email not sent and Immediate window is emppty. Why, please ?
But what confuses me also is how can I have windows service published on some asp.net server ?
|
|
|
|
|
Member 1648727 wrote: email not sent and Immediate window is emppty
What is in your SendMail() method?
Member 1648727 wrote: But what confuses me also is how can I have windows service published on some asp.net server ?
Just install the service on the ASP.NET machine when it is done.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Expert Coming wrote: What is in your SendMail() method?
Irrelevant
Expert Coming wrote: Just install the service on the ASP.NET machine when it is done.
Not a good idea. Besides the OP seems a bit confused as to what s/he wants.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: Expert Coming wrote:
What is in your SendMail() method?
Irrelevant
I may be missing something here but he said it didn't send the message. We need to see the code that trys to send it to help figure out what is wrong right?
Mark Nischalke wrote: Expert Coming wrote:
Just install the service on the ASP.NET machine when it is done.
Not a good idea. Besides the OP seems a bit confused as to what s/he wants.
I could agree with this though. But I still think that for the question asked, I answered it correctly. That is if the OP understood what they wanted.
P.S. - I took no offense to that, but I would like to get some understanding too...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
The SendMail method is irrelevant because the OP was trying to run the service incorrectly so the method would never be run anyway. A Windows Service can't started simply be pushing F6.
"Cannot start a service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrator tool or the NET START command."
only two letters away from being an asset
|
|
|
|
|
Wow, I can't believe I didn't think about that. Thanks.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
You can't start a Windows Service like that. Start here http://msdn2.microsoft.com/en-us/library/d56de412(VS.80).aspx[^]
Member 1648727 wrote: how can I have windows service published on some asp.net server
Do a little more research and figure out what it is you want, a web service or a windows service.
only two letters away from being an asset
|
|
|
|
|
Hello guys (and girls),
Thank you for your help, I appreciate that
I have finished all the coding.
Program checks a web site and if it finds one specific word then it emails result and sends sms to mobile number. (sorry cant copy/past code because company rules)
Now only question is : Will it be a web service or windows service ?
If I am going to place it locally on my computer then I will need to do some additional checks , like is there any Internet connection and so. I dont like that.
Is it possible to have this code running on some remote server? (I have godaddy account but don't know where to look). Isnt that what web service do ?
THANK YOU ALL !
|
|
|
|
|
Webservices are more of a pull technology. Something must initiate the action. A Windows Service on the other hand can be designed to self trigger, or run at a set interval.
Member 1648727 wrote: like is there any Internet connection and so. I dont like that.
Without an internet connection how are you planning on checking these websites for keywords?
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: Webservices are more of a pull technology. Something must initiate the action. A Windows Service on the other hand can be designed to self trigger, or run at a set interval.
Hello Mark
Yes I know web services are more like pull technology. I work in a company that works together with airlines. Our present project is SMS client which tracks flights and sends information to passenger mobile phone. Thats where we needed web services.
But this other problem I have is little bit different.
To have some small program running all the time which can check some url periodicaly ...
Mark Nischalke wrote: Without an internet connection how are you planning on checking these websites for keywords?
So I need two things
- PC running all the time
- Internet connection
That looks like server, right. Now I come to conclusion:
You can't install it at some real server like 'windows service' (unless you are IT administrator in your local company)
You can't install it as 'web service' because it will need something to invoke it, and you don't wanna to do that.
Please someone , let me know that is practice here, so I don't go around to much
I will ask godaddy support if they know anything about this...
Cheers!
|
|
|
|
|
Member 1648727 wrote: Please someone , let me know that is practice here, so I don't go around to much
You have been given the answer, several times. This project is clearly beyond your abilities if you can't see that. Leave it someone else, or give up.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: You have been given the answer, several times.
No I didnt get clear answer "several times" because probably no one here understands this matter, or maybe I was not clear enough.
Mark Nischalke wrote: This project is clearly beyond your abilities if you can't see that. Leave it someone else, or give up.
No its not "beyond my abilities":
Imports System.Net.Mail<br />
Imports System.IO.Ports<br />
<br />
Public Class Service1<br />
<br />
Public Names(25, 2) As String<br />
<br />
Public Sub CheckBAH()<br />
Dim strHTML As String = GetPageHTML("http://www.**********.aspx")<br />
Dim pos As Integer = strHTML.IndexOf("")<br />
strHTML = strHTML.Substring(pos, 200)<br />
Dim Username As String = strHTML.Substring(3, strHTML.IndexOf("(") - 3).Trim<br />
'Dim pin As String = strHTML.Substring(3, strHTML.IndexOf("(") - 3).Trim<br />
<br />
Dim eur As Integer = strHTML.IndexOf("€")<br />
Dim Prize As String = strHTML.Substring(eur - 10, 10)<br />
<br />
Dim i As Integer<br />
For i = 0 To 25<br />
If Username.ToUpper = Names(i, 0).ToUpper Then<br />
SendEmail(" Izvucen si ", Names(i, 0) & Names(i, 1) & Prize, "*************@yahoo.com")<br />
'SendEmail(" Izvucen si ", Names(i, 0) & Names(i, 1) & Prize , "*************@yahoo.com")<br />
End If<br />
Next<br />
End Sub<br />
<br />
Public Function GetPageHTML(ByVal URL As String) As String<br />
' Retrieves the HTML from the specified URL<br />
Dim objWC As New System.Net.WebClient()<br />
Return New System.Text.UTF8Encoding().GetString(objWC.DownloadData(URL))<br />
End Function<br />
<br />
Public Function SendEmail(ByVal strSubject As String, ByVal strBody As String, ByVal strEmail As String) As String<br />
Dim message As New MailMessage(strEmail, strEmail, strSubject, strBody)<br />
Dim emailClient As New SmtpClient("out.mail.bih.net.ba")<br />
Dim SMTPUserInfo As New System.Net.NetworkCredential("******", "******")<br />
emailClient.UseDefaultCredentials = False<br />
emailClient.Credentials = SMTPUserInfo<br />
<br />
emailClient.Send(message)<br />
Return 0<br />
End Function<br />
<br />
Private Sub InitializeComponent()<br />
Me.components = New System.ComponentModel.Container<br />
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)<br />
Me.SuspendLayout()<br />
'<br />
'Timer1<br />
'<br />
Me.Timer1.Interval = 1000<br />
'<br />
'Service1<br />
'<br />
Me.ClientSize = New System.Drawing.Size(292, 266)<br />
Me.Name = "Service1"<br />
Me.ResumeLayout(False)<br />
<br />
End Sub<br />
<br />
<br />
Public Sub ReadNames()<br />
Names(0, 0) = "********"<br />
.........<br />
Names(25, 1) = "**********"<br />
End Sub<br />
<br />
<br />
Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
<br />
Debug.Print(Internet)<br />
'CheckBAH()<br />
End Sub<br />
Private Function Internet() As Boolean<br />
Dim siteResponds As Boolean = False<br />
Try<br />
siteResponds = My.Computer.Network.Ping("www.google.com")<br />
Catch ex As Exception<br />
<br />
Return siteResponds<br />
End Try<br />
Return siteResponds<br />
End Function<br />
<br />
Private Sub Service1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
ReadNames()<br />
Timer1.Start()<br />
<br />
End Sub<br />
End Class<br />
|
|
|
|
|
Listing code doesn't prove any ability beyond cut & paste, especially since its only VB.
Member 1648727 wrote: probably no one here understands this matter, or maybe I was not clear enough.
I highly, highly doubt the former is true and it is quite arrogant of you consider it as an excuse. The statement proves, as I stated before, the concept is beyond you to understand and see that you have the answers.
only two letters away from being an asset
|
|
|
|
|
Hy!
I filled a GridView with some data from a table(obtained from a DataBase).
Now i have to delete some row, but i have to do this without deleting that information from the DataBase. It would be easy to use DataBase. I would obtain that table and fill that GridView again on the pageLoad, but i'm not aloud.
I really didn't find how to do this.
Please someone help! If this is possible.
|
|
|
|
|
How are you binding the data to the GridView? Are you using a DataTableAdapter or some other object? A DataTable or DataSet are in-memory representations of the data, so unless you are calling a method to delete the row directly in the database, you should only be working with a temporary copy of the data.
only two letters away from being an asset
|
|
|
|