Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Mixing SSL/non SSL pages

Reply
Thread Tools

Mixing SSL/non SSL pages

 
 
tesis
Guest
Posts: n/a
 
      07-20-2007
Hi all gurus;
forgive me if I'm writing about a basic question.
I need to call a secured (SSL) page from a .aspx page. Calling an
absolute URL rises an error (invalid path... Virtual path required), so
I'm not able to intermix http and https calls. Is there a way to make it
so? TIA



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-20-2007
"tesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Hi all gurus;
> forgive me if I'm writing about a basic question.
> I need to call a secured (SSL) page from a .aspx page. Calling an
> absolute URL rises an error (invalid path... Virtual path required), so
> I'm not able to intermix http and https calls. Is there a way to make it
> so? TIA


Please show your code.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
tesis
Guest
Posts: n/a
 
      07-22-2007

LOT, Mark, 4 your rpy. Here's my (real) code:

Private Sub btnRinnCrCard_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnRinnCrCard.Click
Session("IdSocieta") = lblIdSoc.Text
Session("Denominazione") = txtDenominazione.Text
Session("ImpRinnovo") = txtImpDovuto.Text
Session("CausaleVers") = "Riaffiliazione"
Session("CodCausale") = "2"
Dim temp As String = Session.SessionID
Dim path As String = Server.MapPath(".")
'it's unuseful to store ds in a Session variable, as it will be
lost switching to https, so it needs to be serialized; better to make it
so now
dsRiepilogo.WriteXml(path + "\" + temp + ".tmp")
Dim serverName As String =
HttpContext.Current.Server.MachineName
If serverName = "AMILO" Then
Server.Transfer("wfrmPagaCarta.aspx") 'development server
Else

Server.Transfer("https://www.fih-hockey.it/TessOnLine/wfrmPagaCarta.aspx
")
End If
End Sub



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-22-2007
"tesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Server.Transfer("https://www.fih-hockey.it/TessOnLine/wfrmPagaCarta.aspx")



Is it not simply that the above URL is actually invalid...?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
tesis
Guest
Posts: n/a
 
      07-22-2007


Hi Mark.
No, unfortunately, the link is valid. (BTW, the site actually listens on
ports 8080/5443, which at this moment are locked but for internal
addresses, so it's unreacheable but from IPs inside the firewall). The
error thrown AFAIK indicates that an absolute url can't be used, only a
virtual one can. Does it make sense? TIA

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
tesis
Guest
Posts: n/a
 
      07-22-2007

Hi Mark, a little clarification!
The code was:

If ServerName = "AMILO" then
Server.Transfer("http://localhost/TessHockey/wfrmPagaCarta.aspx")
else
Server.Transfer("https://www.fih-hockey.it/TessOnLine/wfrmPagaCarta.aspx
")
endif

and the error was thrown even walking the 1st part of the if statement,
so for developing I changed it in a relative path.


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-22-2007
"tesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> No, unfortunately, the link is valid. (BTW, the site actually listens on
> ports 8080/5443, which at this moment are locked but for internal
> addresses, so it's unreacheable but from IPs inside the firewall). The
> error thrown AFAIK indicates that an absolute url can't be used, only a
> virtual one can. Does it make sense? TIA



Apologies - completely missed that!

Yes, you're quite correct - Server.Transfer doesn't allow absolute paths,
only relative ones, because it considers a double slash (// or \\) as an
invalid character combination:
http://msdn2.microsoft.com/en-us/library/ms525800.aspx

So, you have three choices:

1) Make the entire site https (probably not a good idea if you only require
SSL on a small section of the site)

2) Use Response.Redirect instead of Server.Transfer (not ideal because of
session management issues)
http://www.google.co.uk/search?hl=en...+session&meta=

3) Use this:
http://www.codeproject.com/aspnet/We...id=53615&exp=0
It's a superb add-in for ASP.NET and, once you've configured it, you really
can just forget it.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
tesis
Guest
Posts: n/a
 
      07-22-2007

I really appreciate your help, Mark.
It's a very interesting solution you quotes on your 3rd chance. I'm
going to try this approach. Thanks again.


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-22-2007
"tesis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> It's a very interesting solution you quotes on your 3rd chance. I'm
> going to try this approach.


I use it for all my sites and web apps which require SSL.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      07-22-2007
re:
!> the site actually listens on ports 8080/5443

If those are the ports which the site listens on, and :
https://www.fih-hockey.it/TessOnLine/wfrmPagaCarta.aspx
is the URL you redirect to, you're redirecting to port 80, not 8080.

I wonder if that could have something to do with your problem.

If you want to redirect to that URL, on port 8080, you should use :

https://www.fih-hockey.it:8080/TessO...PagaCarta.aspx




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
"tesis" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>
>
> Hi Mark.
> No, unfortunately, the link is valid. (BTW, the site actually listens on
> ports 8080/5443, which at this moment are locked but for internal
> addresses, so it's unreacheable but from IPs inside the firewall). The
> error thrown AFAIK indicates that an absolute url can't be used, only a
> virtual one can. Does it make sense? TIA
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mixing compiled and uncopmiled pages JJ ASP .Net 7 12-21-2007 01:55 PM
Mixing JSP pages between Apache and Tomcat euroq Java 3 09-02-2006 05:51 PM
QUERY: Mixing ASP.NET 1.1 & 2.0 pages in same website dhruba.bandopadhyay ASP .Net 0 04-28-2006 02:28 PM
Mixing secure and unsecure pages with Forms Authentication =?Utf-8?B?TVIuIFVOREVSSElMTA==?= ASP .Net 4 05-27-2004 09:06 PM
How to imbed non-SSL links within SSL pages without using code CW ASP .Net 2 05-02-2004 01:40 PM



Advertisments