Click here to Skip to main content
15,913,055 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwhy nobody answer my question. is it really so complicated? Pin
m.rastgar12-Dec-06 2:44
m.rastgar12-Dec-06 2:44 
AnswerRe: why nobody answer my question. is it really so complicated? Pin
ednrgc12-Dec-06 3:30
ednrgc12-Dec-06 3:30 
AnswerRe: why nobody answer my question. is it really so complicated? Pin
GaryWoodfine 12-Dec-06 5:40
professionalGaryWoodfine 12-Dec-06 5:40 
QuestionProblem in Importing data from excel to database,please help me Pin
kishore19@hotmail.com12-Dec-06 1:48
kishore19@hotmail.com12-Dec-06 1:48 
QuestionTo control the size of the dropdownlist's item [modified] Pin
Senthil Kumar Murugan12-Dec-06 1:46
Senthil Kumar Murugan12-Dec-06 1:46 
QuestionFailed to map the path '/WSConcessionaria/App_GlobalResources/'. Pin
Imran Khan Pathan12-Dec-06 1:03
Imran Khan Pathan12-Dec-06 1:03 
GeneralAllocation of images on site Pin
El'Cachubrey12-Dec-06 1:02
El'Cachubrey12-Dec-06 1:02 
QuestionBatch Problem asp.net and vb.net Pin
Carlos Felipe12-Dec-06 0:43
Carlos Felipe12-Dec-06 0:43 
It is great in debug mode, but in IIS dont run the batch file, create a file but dont insert text. Is it a bad setup or code???
I tried dont use dsget but it gets "ASPNET" as username.
Please help me!!!
Thanks and sorry my english...


Imports System.DirectoryServices
Partial Class _Default
Inherits System.Web.UI.Page
Dim Grp As String

Protected Sub GetName()
Dim al As New ArrayList()
Dim line, Name As String
Dim writeName As System.IO.StreamWriter
writeName = IO.File.CreateText("c:\getname.bat")
'Dim strUserName As String
'strUserName = HttpContext.Current.User.Identity.Name
'If InStr(strUserName, "XX") Then
'strUserName = strUserName.Replace("XX\", "")
'End If
writeName.WriteLine("%systemroot%\adlsbin\dsget.exe USER " & """CN=%USERNAME%,OU=Users,OU=XXX,DC=XX,DC=XXXXXXXXXX,DC=XX"" -fn -ln > c:\user.txt")
writeName.Close()
CmdStart("c:\getname.bat")
Dim readUser As System.IO.StreamReader
readUser = IO.File.OpenText("C:\user.txt")
While readUser.Peek <> -1
line = readUser.ReadLine()
If line <> Nothing Then
al.Add(line)
End If
End While
readUser.Close()
If al.Count = 0 Then
'Response.Write(" alert(""user.txt is Empty!"")")
Return
Else
Name = Trim(Replace(al.Item(1), " ", " "))
TxtName.Text = Name
End If

End Sub

Protected Sub CmdStart(ByVal Str As String)
Dim exec As System.Diagnostics.Process = New System.Diagnostics.Process
exec.StartInfo.FileName = Str
exec.StartInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Hidden
exec.Start()
exec.WaitForExit()
End Sub

Protected Sub ExecGroup(ByVal StrGroup As String)
CmdStart(StrGroup)
GetFTID("c:\members.txt")
IO.File.Delete("c:\members.txt")
End Sub

Protected Sub GetID(ByVal MembersTXT As String)
Dim line, s, ID, name, message As String
Dim al As ArrayList = New ArrayList
Dim al2 As ArrayList = New ArrayList
Dim cont, i As Integer
cont = 0
Dim readMembers As System.IO.StreamReader
readMembers = IO.File.OpenText(MembersTXT)
While readMembers.Peek <> -1
line = readMembers.ReadLine()
If line <> Nothing Then
al.Add(line)
End If
End While
readMembers.Close()
For Each s In al
ID = s.Substring(4, 8)
cont = cont + 1
al2.Add(ID)
Next
name = TxtName.Text

'Replace Enter to space
message = Trim(Replace(msg.Text, vbNewLine, " "))

Dim Data As String = Now()
Dim Datestr As String = DateString()

'Declare variables
Dim sFileName As String = "c:\log" & Datestr & ".txt"
Dim myFileStream As New System.IO.FileStream(sFileName, _
IO.FileMode.Append, IO.FileAccess.Write, IO.FileShare.None)

'Create the stream writer
Dim myWriter As New System.IO.StreamWriter(myFileStream)
myWriter.WriteLine("******************************************************")
myWriter.WriteLine(vbCr)
myWriter.WriteLine(Data)
myWriter.WriteLine("--------------------")
myWriter.WriteLine(vbCr)

'Flush before close
myWriter.Flush()
'Close everything
myWriter.Close()
myFileStream.Close()

Dim netSend As System.IO.StreamWriter
netSend = IO.File.CreateText("c:\netsend.bat")
For i = 0 To cont - 1
netSend.WriteLine("net send " & al2(i) & " " & name & ": " & message & " >> c:\log" & Datestr & ".txt")
Next
netSend.Close()
ExecNetSend("c:\netsend.bat")
End Sub

Protected Sub ExecNetSend(ByVal StrNS As String)
CmdStart(StrNS)
Response.Write(" alert(""Message has been Sent!"")")
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Button1.Click
Dim G As String
Dim group As System.IO.StreamWriter
group = IO.File.CreateText("c:\group.bat")
If Grp = "XXXX" Then
G = "CN=XXXXXXXXX"
ElseIf Grp = "XXXX" Then
G = "CN=XXXXXXXXX"
ElseIf Grp = "XXXX" Then
G = "CN=XXXXXXXXX"
Else
Response.Write(" alert(""Please Select a Destination Group"")")
group.Close()
Return
End If
group.WriteLine("%systemroot%\adlsbin\dsget.exe group " & """" & G & ",OU=Groups,OU=XXX,DC=XX,DC=XXXXX,DC=XX"" -members > c:\members.txt")
group.Close()
ExecGroup("c:\group.bat")
IO.File.Delete("c:\group.bat")
IO.File.Delete("c:\netsend.bat")
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Button2.Click
msg.Text() = ""
End Sub

Protected Sub GBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GBox.SelectedIndexChanged
Grp = GBox.SelectedValue
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Button3.Click
Response.Write(" { window.close();}")
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GetName()
IO.File.Delete("c:\getname.bat")
IO.File.Delete("c:\user.txt")
End Sub

End Class
QuestionBrowsing problem Pin
OlaMohammed12-Dec-06 0:35
OlaMohammed12-Dec-06 0:35 
AnswerRe: Browsing problem Pin
karam chandrabose12-Dec-06 0:41
karam chandrabose12-Dec-06 0:41 
GeneralRe: Browsing problem Pin
OlaMohammed12-Dec-06 0:56
OlaMohammed12-Dec-06 0:56 
AnswerRe: Browsing problem Pin
l0kke12-Dec-06 0:52
l0kke12-Dec-06 0:52 
GeneralRe: Browsing problem Pin
karam chandrabose12-Dec-06 2:00
karam chandrabose12-Dec-06 2:00 
GeneralRe: Browsing problem Pin
karam chandrabose12-Dec-06 2:01
karam chandrabose12-Dec-06 2:01 
QuestionCalendar Control Pin
aaraaayen12-Dec-06 0:34
aaraaayen12-Dec-06 0:34 
AnswerRe: Calendar Control Pin
l0kke12-Dec-06 0:53
l0kke12-Dec-06 0:53 
GeneralRe: Calendar Control Pin
aaraaayen12-Dec-06 1:48
aaraaayen12-Dec-06 1:48 
QuestionHow to add a checkbox in a datagrid using datagrid Pin
sivaraman_ms12-Dec-06 0:05
sivaraman_ms12-Dec-06 0:05 
AnswerRe: How to add a checkbox in a datagrid using datagrid Pin
Imran Khan Pathan12-Dec-06 0:56
Imran Khan Pathan12-Dec-06 0:56 
AnswerRe: How to add a checkbox in a datagrid using datagrid Pin
postmaster@programmingknowledge.com12-Dec-06 16:17
postmaster@programmingknowledge.com12-Dec-06 16:17 
QuestionDeployment of Asp.net 2.0 Application. Pin
Kamal.Afridi11-Dec-06 23:59
Kamal.Afridi11-Dec-06 23:59 
AnswerRe: Deployment of Asp.net 2.0 Application. Pin
karam chandrabose12-Dec-06 0:42
karam chandrabose12-Dec-06 0:42 
GeneralRe: Deployment of Asp.net 2.0 Application. [modified] Pin
Kamal.Afridi12-Dec-06 1:03
Kamal.Afridi12-Dec-06 1:03 
QuestionDataSet bulk update problem Pin
Dinuraj11-Dec-06 23:28
Dinuraj11-Dec-06 23:28 
QuestionValidation Controls in ASP.Net Pin
kulile11-Dec-06 23:25
kulile11-Dec-06 23:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.