 |
|
 |
I have problem like this..
example :
IIS server is located in ip 10.123.123.56/mysub port 80, and this is in local network group..
but a user want to browsing to that site using dial-up connection..
so that user have IP 192.168.155.24, to browse into that site, that public IP for that server IIS is 192.168.155.4/mysub
in the first run there is no problem in that, but when app is postback, IP was change into local network group 10.123.123.56/mysub this will send back to browser address not found because it's out of range from public IP dial-up...
question is :
how to make the IP address never change aka it's always 192.168.155.4/mysub not 10.123.123.56/mysub
is there need any configuration in IIS ? or somethink else
sorry for my bad english... i hope you're understand
.:. Apakek System .:.
|
|
|
|
 |
|
 |
You could use VirtualPathUtility.RemoveTrailingSlash(val1) instead of a few of the cases you have listed in RedirectIsValid()
just thought i'd mention that
|
|
|
|
 |
|
 |
I am trying to catch all requests on the first level of a web site, like:
domain.com/my.name
And then I can forward the user depending on his name.
It works great (with a couple of adjustments in VWD Express, once everything is running under a virtual directory:
localhost:3081/domainForward/my.name
****
But as soon I copy the code to an IIS6 server and it is running under the root, IIS is only doing what I want if the filename ends with "*.aspx"
All other pages will receive a 404 Error.
Does anybody know a setting in IIS 6 to catch all possible names...?
Thanks
P.S. I have a solution now, whereby I redirect 404 pages to default.aspx but these are lots of redirects....
-- modified at 19:55 Friday 27th October, 2006
|
|
|
|
 |
|
 |
Hi,
We have a estore site which supports cross browser and cross platform. Now We have to enhance for multi-company support. Currently I have two option as below.
1. Same site with different URL for different company
2. Host individual site for every company
Please suggest whether we should follow the host header as you have suggested in this article to implement the 'Same site with different URL for different company'. Let me know the constraints this approach has. As i have read somewhere that if your site is accessed through SSL then host header will not work.
Suppose i have three url for three different company as below
10.92.17.25 www.aaa.com
10.92.17.25 www.bbb.com
10.92.17.25 www.ccc.com
If i follow the approach you have mentioned in this article, Please tell me what exactly i have to do to map one IP address with these three urls as a pre-requirement.
One more thing, this site has to be deployed in DMZ.
Thanks,
Mukesh Das
|
|
|
|
 |
|
 |
You have to choose depending on your access permission on the webserver.
If your are lucky to be in full control of the webserver you can use either. The more obvious is to use the webserver's own tools (Hostheader, Virtual Directory, Redirect to URL, etc.)
If not, you have to a workaround using some code, for example the this little domain forwarding.
Secondly it depends on the configuration options and capabilities of your estore. I do not know any details.
When using the code in this article:
- Download the code
- Build it
- Copy the resulting dll in your bin directory
- Add your hostnames and the target directories to the web.config file as show in the example.
- Additionally configure the httpHandlers section in the web.config file
|
|
|
|
 |
|
 |
Hi Andi,
Thanks for prompt reply from your side.
I am trying the following solution with domain forwarding, please let me whether this will work or not.
Suppose i have single estore which supports multiple companies and accessed as below in intranet scenario on developer machine.
For Company 'abc'
http://mukeshdas/estore?companyid = 'abc'
For Company 'xyz'
http://mukeshdas/estore?companyid = 'xyz'
in this scenario, domain forwarding will do nothing.
Now when this will be hosted in production along with ISA Server. Multiple url for different company will be mapped to single IP address of the web server as below.
COMPANY URL IP ADDRESS
===========================================
abc www.abc.com 10.92.17.22
xyz www.xyz.com 10.92.17.22
Now www.abc.com and www.xyz.com will hit to 'estore' site on 10.92.17.22. Here the domain forwarder will resolve the company based upon the url as below
www.abc.com => 10.92.17.22/estore?companyid = 'abc'
www.xyz.com => 10.92.17.22/estore?companyid = 'xyz'
Please let me know whether this approach will work or not? I have one more confusion here is, do i require any host header setting here?
Andi, i have full control of web server right now and all kind of hardware/software configuration option.
Thanks,
Mukesh Das
|
|
|
|
 |
|
 |
Hi Mukesh,
You fully got it, that's the way it will work!
It is not reqired to use hostheaders in this szenario.
Your nameservers are configured to resolve www.abc.com to 10.92.17.22 and also ww.xyz.com. So all request will go to your webserver at 10.92.17.22.
The domainforwarding will recognize the request-url (www.abc.com or www.xyz.com) and forward the request to the matching estore.
Cheers,
Andi
|
|
|
|
 |
 | VB.NET  |  | jtisdale | 12:10 25 Sep '04 |
|
 |
Thanks for the article. This is exactly what I'm trying to do. I had a nice way of doing this in classic ASP but I'm now converting it to .NET. Unfortunately, I am doing so in VB.NET. I wish you would also post code examples in VB.NET.
Thanks, JT
|
|
|
|
 |
|
 |
Here is the main class in VB.NET
Imports System.Web
Imports System.Configuration
Public Class DomainHandler
Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest
Dim redir As String = ConfigurationSettings.AppSettings _
(context.Request.Url.Host)
If redir <> String.Empty Then
If RedirectIsValid(redir, context.Request.Url) Then
context.Response.Redirect(redir, True)
Else
context.Response.Write("<h1><font color=red>" & _
"Error invalid DomainHandler configuration</font>" & _
</h1><br><b>Please check your Web.config file.</b>")
End If
End If
End Sub
' prevents possible redirect loops
' it is not allowed to have an redirect url targeting its self
Private Function RedirectIsValid( _
ByVal redir As String, _
ByVal currentUri As Uri) _
As Boolean
Dim val1 As String = redir.ToLower()
Dim url As String = currentUri.AbsoluteUri.ToLower()
Dim host As String = currentUri.Host.ToLower()
If val1 = url Then
Return False
End If
If val1 = ("http://" + host) Then
Return False
End If
If val1 = ("http://" + host + "/") Then
Return False
End If
If val1 = host Then
Return False
End If
If val1 = (host + "/") Then
Return False
End If
Return True
End Function
' Implementing IHttpHandler
Public ReadOnly Property IsReusable() As Boolean _
Implements IHttpHandler.IsReusable
Get
Return True
End Get
End Property
End Class
|
|
|
|
 |
|
 |
Dicke,
Awesome, thanks very much.
Appreciated, John
|
|
|
|
 |
|
 |
I am interested in mapping all request on my site for *.html pages to *.aspx pages. Is this possible using an HttpHandler? I have tried to slightly modify the sample here, but either my handler is not loading or it is not working. It could be my section of web.config is wrong - I don't know.
Any suggestions?
Thanks,
Neal Stublen
http://www.awesoftware.com
|
|
|
|
 |
|
 |
Ah-ha! I got it working. I minor bug in my logic for handling the mapped URL. If anyone else is interested, I changed web.config: <httpHandlers> <add verb="*" path="*.htm*" type="mydomain.HtmlRedirect, mydomain" /> </httpHandlers> And I changed the logic in ProcessRequest(): string target = context.Request.Url.ToString(); string redir = target.Replace(".html", ".aspx"); redir = redir.Replace(".htm", ".aspx"); if (redir != target) { context.Response.Redirect(redir, true); } That did it! Neal Stublen http://www.awesoftware.com
|
|
|
|
 |
|
 |
maybe I'm mising the point, but why don't you just setup three different websites on iis?
as long you you sepecify their host headers this will work.
did I miss something?
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
 |
|
 |
The IIS Configuration above is usually the one, an ISP would use for a multi-domain account.
When you purchase a webaccount from your ISP, which hosts on Windows 2000 and ASP.NET, you will get one configured website.
Often you have the option to register multible domains for your account. The domains are mapped to your account the way it is shown above.
Example:
You have one webaccount.
You have to domains mapped to it
1. www.mycompany.com
2. www.myspecialproduct.com
Your company's homepage is addressed at:
http://www.mycompany.com/default.aspx
Your product is located at:
http://www.mycompany.com/products/myspecialproduct.aspx
Without additional effort, when somebody types
http://www.myspecialproduct.com
in his webbrowser, he will reach your company's homepage and not the specialproduct page.
Domain-Forwarding helps to redirect the user to the expected target page.
|
|
|
|
 |
|
 |
Instead of making a redirect and let the user notices the url change, is there a chance to make something like server.execute from inside the handler to call/execute a different page based on the requested domain ?
|
|
|
|
 |
|
 |
Yes, though the correct API to use for these things would be HttpContext.RewritePath(), and it belongs done in a HttpModule, not a HttpHandler.
--
-Blake (com/bcdev/blake)
|
|
|
|
 |
|
 |
Does it work if www.mydomain.com/app is an asp.net app ? (app inside another app) ?
|
|
|
|
 |
|
 |
Yes, sure.
But consider, use it as an individual application, because of the configuration in the "httpHandlers"-section in the web-config file, every page named "Default.aspx" is affected by the forwarding, no matter in with subdirectory of the application.
Best use is to install it in your root-web. And configure here your forwardings to differnert sub-webs (applications).
|
|
|
|
 |
|
 |
But how do you get this to work if no file name is specified after the server name? I can only get this to work on my root Web if I specify the file name in the URL. When I leave that off, IIS redirects me to http://localhost/localstart.asp. I've changed the path in the Web.config file to "/", "\", "*", and even "*.*" but it always goes to the localstart.asp page.
Thoughts?
Rhy Mednick Heart,Soul, Flesh, and Bones
Chicken Scratch Software Because typing is for sissieshttp://www.ChickenScratchSoftware.com
|
|
|
|
 |