Click here to Skip to main content
15,896,269 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: fade current UpdatePanel and show a center progress Pin
Not Active11-Nov-10 2:17
mentorNot Active11-Nov-10 2:17 
Questionclose parent window without alert message in ie7 Pin
vishnukamath10-Nov-10 19:09
vishnukamath10-Nov-10 19:09 
AnswerRe: close parent window without alert message in ie7 Pin
Anurag Gandhi10-Nov-10 20:08
professionalAnurag Gandhi10-Nov-10 20:08 
GeneralRe: close parent window without alert message in ie7 Pin
vishnukamath10-Nov-10 20:25
vishnukamath10-Nov-10 20:25 
AnswerRe: close parent window without alert message in ie7 Pin
thatraja10-Nov-10 20:24
professionalthatraja10-Nov-10 20:24 
GeneralRe: close parent window without alert message in ie7 Pin
vishnukamath10-Nov-10 21:20
vishnukamath10-Nov-10 21:20 
AnswerRe: close parent window without alert message in ie7 Pin
thatraja28-Nov-10 0:41
professionalthatraja28-Nov-10 0:41 
QuestionReading PDF Files on Remote Server [modified] Pin
bgates197010-Nov-10 11:01
bgates197010-Nov-10 11:01 
I know this is sort of an old topic but with all the code snippets I've attempted I still can't get it to perform consistently. Essentially, I'm trying to open a PDF on a server that is not on the domain but a Workgroup. The IIS 6 server is on the domain and the files reside on the Workgroup server. I'm using VS2008/.NET 3.5

*** Code to Open File from ASP.NET page

'\\Server1\contracts\newlondon.pdf
Dim sFullPath As String = sServer + sFolder + sFile

Dim wcClient As WebClient = New WebClient()

Dim obj As UserManager = New UserManager
obj.CreateIdentity("user1", "Server1", "password")

Dim buffer As Byte() = wcClient.DownloadData(sFullPath)

Response.ClearContent()
Response.AddHeader("Content-Disposition", "inline; filename=userdoc" + oDocument.FileExtension.ToString)
Response.ContentType = returnExtension(oDocument.ContentType.ToString)
Response.AddHeader("content-length", buffer.Length.ToString)
Response.BinaryWrite(buffer)

obj = Nothing

***
*** Create Identity (which I found on CodeProject)

Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As String, _
    ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Integer, _
    ByVal dwLogonProvider As Integer, ByRef phToken As IntPtr) As Integer

   Declare Auto Function CloseHandle Lib "kernel32.dll" (ByVal handle As IntPtr) As Boolean

   Public Sub CreateIdentity(ByVal User As String, ByVal Domain As String, ByVal Password As String)
       Dim tokenHandle As New IntPtr(0)
       Dim ret As Integer
       Dim LOGON32_PROVIDER_DEFAULT As Integer = 0
       Dim LOGON32_LOGON_NETWORK_CLEARTEXT As Integer = 3

       tokenHandle = IntPtr.Zero
       Dim returnValue As Boolean = LogonUser(User, Domain, Password, LOGON32_LOGON_NETWORK_CLEARTEXT, LOGON32_PROVIDER_DEFAULT, tokenHandle)
       If False = returnValue Then
           ret = Marshal.GetLastWin32Error()
           Throw New Exception("LogonUser failed with error code: " + ret.ToString)
       End If
       Dim id As New WindowsIdentity(tokenHandle)
       CloseHandle(tokenHandle)
       id.Impersonate()
   End Sub

*****

I've had it working a couple times on my workstation but never from the webserver. I usually get "Unknown username or password" or "Access to ..... denied!"

I have identity impersonate="true" in the Web.Config.

modified on Thursday, November 11, 2010 10:55 AM

AnswerRe: Reading PDF Files on Remote Server Pin
Not Active10-Nov-10 12:42
mentorNot Active10-Nov-10 12:42 
Questionwant to expect some controls to be not cached , How ? Pin
Honeyboy_2010-Nov-10 3:01
Honeyboy_2010-Nov-10 3:01 
AnswerRe: want to expect some controls to be not cached , How ? Pin
Brij10-Nov-10 6:38
mentorBrij10-Nov-10 6:38 
QuestionCreate sample standalone forum similar to jitbit, Pin
swornavidhya_m10-Nov-10 1:18
swornavidhya_m10-Nov-10 1:18 
AnswerRe: Create sample standalone forum similar to jitbit, Pin
JHizzle10-Nov-10 2:55
JHizzle10-Nov-10 2:55 
QuestionFirst Loading is Slow... in a while Pin
Dirso9-Nov-10 9:05
Dirso9-Nov-10 9:05 
AnswerRe: First Loading is Slow... in a while Pin
Vimalsoft(Pty) Ltd9-Nov-10 10:33
professionalVimalsoft(Pty) Ltd9-Nov-10 10:33 
AnswerRe: First Loading is Slow... in a while (modified) Pin
Manfred Rudolf Bihy10-Nov-10 2:19
professionalManfred Rudolf Bihy10-Nov-10 2:19 
QuestionHow to ignore textbox control focus while using TAB. Pin
Asif Rehman9-Nov-10 2:14
Asif Rehman9-Nov-10 2:14 
AnswerRe: How to ignore textbox control focus while using TAB. Pin
Brij9-Nov-10 6:33
mentorBrij9-Nov-10 6:33 
AnswerRe: How to ignore textbox control focus while using TAB. Pin
TweakBird9-Nov-10 7:00
TweakBird9-Nov-10 7:00 
QuestionHow to raise Window.ShowModalDialog and Window.open simultaniously Pin
kuusuma9-Nov-10 0:35
kuusuma9-Nov-10 0:35 
AnswerRe: How to raise Window.ShowModalDialog and Window.open simultaniously Pin
Not Active9-Nov-10 2:16
mentorNot Active9-Nov-10 2:16 
AnswerRe: How to raise Window.ShowModalDialog and Window.open simultaniously Pin
Shameel9-Nov-10 3:43
professionalShameel9-Nov-10 3:43 
AnswerRe: How to raise Window.ShowModalDialog and Window.open simultaniously Pin
T M Gray9-Nov-10 8:11
T M Gray9-Nov-10 8:11 
QuestionTheme and Skin Pin
Satish_S8-Nov-10 17:58
Satish_S8-Nov-10 17:58 
AnswerRe: Theme and Skin Pin
Tej Aj8-Nov-10 19:08
Tej Aj8-Nov-10 19:08 

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.