Re: Passing custom headers to login page
Adam Tuliper <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
if Im reading your stmt correctly:
"I wanted to simply do the authentication in the Page_Load based on the
custom headers sent over SSL but there does not appear to be a way to
programatically authenticate a user when using Forms based authentication, "
you can programmatically use forms auth like such - but you cannot pass that
info to another site like you wanted. You cant force a browser to send these
headers to another site like you are looking to.. so you can accept the
posted values and just authenticate them and grant them the ticket using
similiar block of code below:
see http://msdn.microsoft.com/en-us/library/aa480476.aspx
if (Membership.ValidateUser(userName.Text, password.Text))
{
if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(userName.Text, false);
}
else
{
FormsAuthentication.SetAuthCookie(userName.Text, false);
}
}
else
{
Response.Write("Invalid UserID and Password");
}
On Thu, Oct 9, 2008 at 3:41 PM, Mont Rothstein <[email protected]>wrote:
> Site 2 is actually ours and Site 1 is an example of how our client can do
> this.
> We are using the standard authenticate Forms with a Login control in Site
> 2.
> I don't yet know if we are going to have an issue with submitting from
> another site or not.
>
> I wanted to simply do the authentication in the Page_Load based on the
> custom headers sent over SSL but there does not appear to be a way to
> programatically authenticate a user when using Forms based authentication,
> so I had to do the ugly Javascript field population hack.
>
> I'll give your suggestion a try.
>
> Thanks,
> -Mont
>
>
> On Thu, Oct 9, 2008 at 3:03 PM, Adam Tuliper <[email protected]>
> wrote:
>
> > because of the way you want to do it.. its a little trickier.
> >
> > so you want to have site 1 write out a page to then post to site 2.
> >
> > do you control site 2? check to make sure site 2 can accept and properly
> > recognize outside postings.
> >
> > write out a page that has a textbox (just off the top of my head)
> > <body onload="javascript:form1.submit();">
> > <form id=form1 name=form1 method=post action="
> > www.site2.com/whatever.aspwhatever">
> > <input type=text value=<%=Response.Header["whatever"]%.>
> > </form>
> > </body>
> > ...
> > ....
> >
> >
> > try that. we were forced ages back to do something similiar. its
> > unfortunate
> > because information sits on a clients machine. oh ya.. turn off all
> caching
> > so login information isn't stored. turn off autocomplete on your
> textboxes
> > as well.
> > autocomplete="off"
> >
> > <StuffNotToDo>
> > Your end result wont end up in your browser the way you are trying.
> > httpwebrequest isn't what Im referring to.. unless.. unless... you can do
> a
> > trick using httpwebrequest to get a session id that you can pass to a
> page
> > on site2 that will create a session. but that would be a total hack.. and
> I
> > would laugh .. hard. and then blog about what not to do and then laugh
> some
> > more : )
> > </StuffNotToDo>
> >
> >
> >
> >
> >
> >
> > On Thu, Oct 9, 2008 at 1:15 PM, Mont Rothstein <[email protected]
> > >wrote:
> >
> > > Thanks for the reply.
> > > Yes, SSL is being used.
> > >
> > > Do you happen to know of an example for that?
> > >
> > > I've used HttpWebRequest before but I'm guessing that isn't what you
> are
> > > referring to because the end result of this needs to appear in the
> > browser.
> > >
> > > Thanks,
> > > -Mont
> > >
> > > ===================================
> > > View archives and manage your subscription(s) at
> > > http://peach.ease.lsoft.com/archives
> > >
> >
> > ===================================
> > View archives and manage your subscription(s) at
> > http://peach.ease.lsoft.com/archives
> >
>
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
>
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives