Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, i have two webapplications (webapp1 and webapp2), webapp1 its with integrated security, and webapp2 its with basic auth, i must from webapp1 login in webapp2 but i cant... :S

 

 

i have this code...

 


Dim strURL As String = "http://localhost/webapp2/webform1.aspx"
Response.ClearHeaders()
Response.ClearContent()

Dim Wapp2WebRequest As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(strURL), System.net.HttpWebRequest)
Wapp2WebRequest.Timeout = 10000
Wapp2WebRequest.MaximumAutomaticRedirections = 50

Dim cCache = New System.Net.CredentialCache

cCache.Add(New Uri(strURL), "Basic", New System.Net.NetworkCredential("User", "Pass", "domain"))

Wapp2WebRequest.Credentials = cCache
Wapp2WebRequest.PreAuthenticate = True

Dim Wapp2WebResponse As System.net.WebResponse
Wapp2WebResponse = CType(Wapp2WebRequest.GetResponse(), System.net.WebResponse)

Dim i As Integer
Response.AddHeader("Location", strURL)
For i = 0 To Wapp2WebRequest.Headers.Count - 1
Response.AddHeader(Wapp2WebRequest.Headers.Keys(i).ToString, Wapp2WebRequest.Headers.Item(i).ToString())
Next
Response.Redirect(strURL)

 

obviusly the response.redirect erease all the headers i add, then i dont know how to get redirected, from this page... :S

 

 

some one can help me???

 

thanks!

Posted

Do you mean you want to log into App 1, and carry it's authentication across to app 2? Can't you set a session cookie in app 1 to note you've logged in successfully, and then just redirect to app 2, where app 2 can check to see if the session cookie has been correctly set...?

 

I did something similiar to this a couple monthes ago.

Posted

no no, i mean, that i create a credential "cCache.Add(New Uri(strURL), "Basic", New System.Net.NetworkCredential("User", "Pass", "domain"))", and with this i log into the server, i have no problem, if i look at "Wapp2WebResponse" i have a good response, and i have the document at the Wapp2WebResponse.getresponsestream but i must to make a redirection to that page... its clear?

 

 

thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...