473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Mixing SSL/non SSL pages

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 ***
Jul 20 '07 #1
13 2245
"tesis" <no****@devdex.comwrote in message
news:uy**************@TK2MSFTNGP05.phx.gbl...
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

Jul 20 '07 #2

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 ***
Jul 22 '07 #3
"tesis" <no****@devdex.comwrote in message
news:eg**************@TK2MSFTNGP02.phx.gbl...
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

Jul 22 '07 #4


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 ***
Jul 22 '07 #5

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 ***
Jul 22 '07 #6
"tesis" <no****@devdex.comwrote in message
news:ug**************@TK2MSFTNGP05.phx.gbl...
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

Jul 22 '07 #7

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 ***
Jul 22 '07 #8
"tesis" <no****@devdex.comwrote in message
news:ev**************@TK2MSFTNGP06.phx.gbl...
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

Jul 22 '07 #9
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" <no****@devdex.comwrote in message news:ug**************@TK2MSFTNGP05.phx.gbl...
>

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 ***

Jul 22 '07 #10
And, of course, that assumes you're using 8080 as your SSL port.

If you're using 5443 as your SSL port, that URL would be :

https://www.fih-hockey.it:5443/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/
======================================
"Juan T. Llibre" <no***********@nowhere.comwrote in message news:O2**************@TK2MSFTNGP03.phx.gbl...
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" <no****@devdex.comwrote in message news:ug**************@TK2MSFTNGP05.phx.gbl...
>>

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 ***


Jul 22 '07 #11

Thank you, Juan, 4 your interest.
Of course you're quite right: I've to include ports in URL if not
addressing port 80 for http and 443 for https. I've just striped ports
from code snipplets for the sake of simplicity. The real code should
address the real ports. I guess I should write in web.config:
encrypedUri="www.mysite.com:5443" unencriptedUri="www.mysite.com:8080".
Have a nice day.

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '07 #12

Hi Mark,
forgive me if I'm bothering you once more.
Since the real code should address the real ports, I guess I've 2 write
in web.config:

encrypedUri="www.mysite.com:5443" unencriptedUri="www.mysite.com:8080"

Am I correct? If not, how2 address non-standard ports?
At the moment, I'm configuring my development environment with version
2.6, since it's FW 1.1 (BTW, notices are 4 3.1, and this caused me some
headache), and addressing ports with encrypted/unencryptedUri is working
fine.
A curious side effect of this module is that having 2 bg pictures with
same name in unsecure dir and secure dir, pages are displayed 1st time
with "unsecure" bg, and then, only when secured, with "secure" bg;
actually, I'm going to use this effect for my advantage.
Have a nice day, and LOT again.
*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '07 #13


Hi gurus.
This approach behaves well in my dev enironment. While switched to
production, however, problems arise. Variable fields in the page are not
saved. Session variables are no more mantained between pages ('cause
SessionId changes) when security module switches between http and https,
nor context variables do. I've read a suggestion to use server.execute,
but this mixes page contents. Cache objects last too long, and
application's can't be used as it's system-wide, and many users can use
the same app at the same time. Cookies may be disabled on clients' side,
and since security module handles the request generating a second
request when switching contexts, even QueryString, I guess (this one are
not have tested), can't be used. What else can I do?

*** Sent via Developersdex http://www.developersdex.com ***
Jul 26 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Knauf | last post by:
Hi everyone, I'm glad to have found this list. I've written a small script for my own use which, amongst other things, captures mouse click information from a window containing an image. I used...
1
by: Andrew Jocelyn | last post by:
Hi Does anyone know if I can use DOTNET assemblies in an ASP Classic page? Basically I want to start writing business logic and database access stuff in DOTNET but I want to use ASP Classic...
2
by: John | last post by:
Hi all, I posted the question a few days ago of including a c# web page in a web solution that already contained VB pages. Thanks for your responses. I suspected I had to go down the separate...
4
by: MR. UNDERHILL | last post by:
I want to use forms authentication on my website. Looking at the documentation, I create a sample site for testing. One of my requirements is to ensure that SOME pages required an authenticated...
1
by: Gabriele Zannoni | last post by:
Hi to all, I have an aesthetic problem to solve. I'm working on the managing part of a site. Some pages can be called with a query string like this: http://mysite.com/manage.aspx?code=300 The...
0
by: dhruba.bandopadhyay | last post by:
I know that it's possible to mix ASP & ASP.NET 1.1 in the same website/application so long as they are in separate frames (iframes). This also holds for mixing ASP & ASP.NET 2.0 pages. But what I...
28
by: ziman137 | last post by:
Hello all, I have a question and am seeking for some advice. I am currently working to implement an algorithmic library. Because the performance is the most important factor in later...
3
by: jason | last post by:
I've been working with C# for over a year now without touching vb.net code. I had a few light years of vb.net before that. No real vb6 or windows form experience. Suddenly, I have an assignment...
7
by: JJ | last post by:
If I provide someone with a compiled page (i.e. an aspx and dll file) to drop into their site, will it work ok if the rest of the site is uncompiled (i.e. no dll's)? Thanks JJ
1
by: David C | last post by:
We have an existing internet application that has been around fairly long and is an asp application. We have been asked to add some pages and we would like to do them in ASP.Net 2.0 or higher. Is...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.