Login Cross WebApplications..???

Rothariger

Regular
Joined
Apr 7, 2004
Messages
66
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...

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!
 
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.
 
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!
 
Back
Top