Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 12, 2010 03:51 PM by sunnyshiny06
Member
69 Points
122 Posts
Feb 08, 2010 11:22 AM|LINK
Hi,
I try to make it works but I still have an error :(
Any help would be super ... THANKS A LOT
This is my webconifg :
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> </configSections> <rewriter> <!-- Rewrite department pages --> <rewrite url="^.*-d([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1" processing="stop"/> <rewrite url="^.*-d([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1&Page=$2" processing="stop"/> <!-- Rewrite category pages --> <rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2" processing="stop"/> <rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2&Page=$3" processing="stop"/> <!-- Rewrite product details pages --> <rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" /> </rewriter> <appSettings> <add key="PaypalEmail" value="test@example.com"/> <add key="PaypalCurrency" value="USD"/> <add key="PaypalReturnUrl" value="http://www.example.com"/> <add key="PaypalCancelUrl" value="http://www.example.com"/> <add key="MailServer" value="mail.example.com"/> <add key="MailUsername" value="example"/> <add key="MailPassword" value="example"/> <add key="MailFrom" value="mail address"/> <add key="EnableErrorLogEmail" value="false"/> <add key="ErrorLogEmail" value="errors@example.com"/> <add key="ProductsPerPage" value="6"/> <add key="ProductDescriptionLength" value="70"/> </appSettings> <connectionStrings> <add name="TestShopConnection" connectionString="Server=(local)\SqlExpress; Database=TestShop; User=sa; Password=password" providerName="System.Data.SqlClient"/> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Server=(local)\SqlExpress;Database=TestnShop; User=sa; Password=password" providerName="System.Data.SqlClient" /> </connectionStrings> <location path="AdminDepartments.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminCategories.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProducts.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProductDetails.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProductAttributes.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access ShoppingCartAdmin.aspx --> <location path="AdminShoppingCart.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminOrders.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access AdminOrders.aspx --> <location path="AdminOrderDetails.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access CustomerDetails.aspx --> <location path="CustomerDetails.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access Checkout.aspx --> <location path="Checkout.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access OrderPlaced.aspx --> <location path="OrderPlaced.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access OrderTest.aspx --> <location path="OrderTest.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <system.web> <httpModules> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> </httpModules> <profile> <properties> <add name="CreditCard" type="System.String"/> <add name="Address1" type="System.String"/> <add name="Address2" type="System.String"/> <add name="City" type="System.String"/> <add name="Region" type="System.String"/> <add name="PostalCode" type="System.String"/> <add name="Country" type="System.String"/> <add name="ShippingRegion" type="System.String"/> <add name="DayPhone" type="System.String"/> <add name="EvePhone" type="System.String"/> <add name="MobPhone" type="System.String"/> </properties> </profile> <roleManager enabled="true"/> <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true" targetFramework="4.0"> <assemblies> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Forms"> <forms name="TestLogin" loginUrl="Login.aspx" timeout="60" /> </authentication> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <customErrors mode="Off" defaultRedirect="~/Oops.aspx"> <error statusCode="404" redirect="~/NotFound.aspx"/> <error statusCode="500" redirect="~/Oops.aspx"/> </customErrors> <pages theme="TestDefault" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> </system.web> <system.codedom> </system.codedom> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" /> </modules> <validation validateIntegratedModeConfiguration="false" /> </system.webServer> </configuration>
And my page look like ...
<ItemTemplate> <h3 class="ProductTitle"> <a href="<%# Link.ToProduct(Eval("ProductID").ToString()) %>"> <%# HttpUtility.HtmlEncode(Eval("Name").ToString()) %> </a> </h3>
But I've an IIS error which said :
All-Star
56620 Points
8958 Posts
Feb 08, 2010 12:33 PM|LINK
The only difference I can see between your code and mine is that I have preCondition set to "":
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" preCondition="" />
I dont know if this makes a difference? (I am pretty new to iis7 myself)
Feb 08, 2010 01:15 PM|LINK
Thanks for your quick feedback... but it doesn't work either ... do you have that for rewrite ? I wonder if iis allow me wildcard :/
<rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" />
Feb 12, 2010 10:07 AM|LINK
Hi
sorry just a last question, i dont get why it doesnt work for me ....
Just to know , do you have iis7?? if yes did you do something on it ...? cuz it looks like my iis look for te folder instead of changing the url ...
Thanks
http://localhost/Ecommerce/Anniversary-Balloons-d3/
Feb 12, 2010 10:29 AM|LINK
Hi tried your CustomTransformWithUrlRewriterNet solution.
But it seems to come from IIS7 cuz it doesn't work either.
http://forums.iis.net/t/1154026.aspx
Feb 12, 2010 10:35 AM|LINK
Yes I have this working on an IIS7 server and I didnt set anything special up.
I have extensionless url rewrites working as well as in www.example.com/manufacturer/
I was talking to somebody yesterday about setting this up on IIS7 and I wrote a little guide for them to go with my IIS6 urlrewriter.net article:
I just noticed that you are not specifying the assembly when you setup the add httpmodule line in iis7 web.config:
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
should be
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
Feb 12, 2010 10:44 AM|LINK
Otherwise my Application Pool is set as ASP.NET v4.0 Classic ??? u too ???
thanks for this i will check ur link
Feb 12, 2010 10:58 AM|LINK
Feb 12, 2010 11:55 AM|LINK
sniiif
Ive tried to update it online but i've the same error ... so its not my iis but my code :/
http://onceuponatimejohanna.com/AppliSolVerte-p8/
Feb 12, 2010 12:26 PM|LINK
sunnyshiny06 Otherwise my Application Pool is set as ASP.NET v4.0 Classic ??? u too ??? thanks for this i will check ur link
No I am running .net 3.5 which I believe would mean a 2.0 app pool?
sunnyshiny06
Member
69 Points
122 Posts
HttpModules Rewrite with IIS 7
Feb 08, 2010 11:22 AM|LINK
Hi,
I try to make it works but I still have an error :(
Any help would be super ... THANKS A LOT
This is my webconifg :
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> </configSections> <rewriter> <!-- Rewrite department pages --> <rewrite url="^.*-d([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1" processing="stop"/> <rewrite url="^.*-d([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1&Page=$2" processing="stop"/> <!-- Rewrite category pages --> <rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2" processing="stop"/> <rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2&Page=$3" processing="stop"/> <!-- Rewrite product details pages --> <rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" /> </rewriter> <appSettings> <add key="PaypalEmail" value="test@example.com"/> <add key="PaypalCurrency" value="USD"/> <add key="PaypalReturnUrl" value="http://www.example.com"/> <add key="PaypalCancelUrl" value="http://www.example.com"/> <add key="MailServer" value="mail.example.com"/> <add key="MailUsername" value="example"/> <add key="MailPassword" value="example"/> <add key="MailFrom" value="mail address"/> <add key="EnableErrorLogEmail" value="false"/> <add key="ErrorLogEmail" value="errors@example.com"/> <add key="ProductsPerPage" value="6"/> <add key="ProductDescriptionLength" value="70"/> </appSettings> <connectionStrings> <add name="TestShopConnection" connectionString="Server=(local)\SqlExpress; Database=TestShop; User=sa; Password=password" providerName="System.Data.SqlClient"/> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Server=(local)\SqlExpress;Database=TestnShop; User=sa; Password=password" providerName="System.Data.SqlClient" /> </connectionStrings> <location path="AdminDepartments.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminCategories.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProducts.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProductDetails.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminProductAttributes.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access ShoppingCartAdmin.aspx --> <location path="AdminShoppingCart.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <location path="AdminOrders.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access AdminOrders.aspx --> <location path="AdminOrderDetails.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access CustomerDetails.aspx --> <location path="CustomerDetails.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access Checkout.aspx --> <location path="Checkout.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only existing customers can access OrderPlaced.aspx --> <location path="OrderPlaced.aspx"> <system.web> <authorization> <allow roles="Customers"/> <deny users="*"/> </authorization> </system.web> </location> <!-- Only administrators are allowed to access OrderTest.aspx --> <location path="OrderTest.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*"/> </authorization> </system.web> </location> <system.web> <httpModules> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> </httpModules> <profile> <properties> <add name="CreditCard" type="System.String"/> <add name="Address1" type="System.String"/> <add name="Address2" type="System.String"/> <add name="City" type="System.String"/> <add name="Region" type="System.String"/> <add name="PostalCode" type="System.String"/> <add name="Country" type="System.String"/> <add name="ShippingRegion" type="System.String"/> <add name="DayPhone" type="System.String"/> <add name="EvePhone" type="System.String"/> <add name="MobPhone" type="System.String"/> </properties> </profile> <roleManager enabled="true"/> <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true" targetFramework="4.0"> <assemblies> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Forms"> <forms name="TestLogin" loginUrl="Login.aspx" timeout="60" /> </authentication> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <customErrors mode="Off" defaultRedirect="~/Oops.aspx"> <error statusCode="404" redirect="~/NotFound.aspx"/> <error statusCode="500" redirect="~/Oops.aspx"/> </customErrors> <pages theme="TestDefault" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> </system.web> <system.codedom> </system.codedom> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" /> </modules> <validation validateIntegratedModeConfiguration="false" /> </system.webServer> </configuration>And my page look like ...
<ItemTemplate> <h3 class="ProductTitle"> <a href="<%# Link.ToProduct(Eval("ProductID").ToString()) %>"> <%# HttpUtility.HtmlEncode(Eval("Name").ToString()) %> </a> </h3>But I've an IIS error which said :
<div> </div> <div> </div> <div> </div>rtpHarry
All-Star
56620 Points
8958 Posts
Re: HttpModules Rewrite with IIS 7
Feb 08, 2010 12:33 PM|LINK
The only difference I can see between your code and mine is that I have preCondition set to "":
I dont know if this makes a difference? (I am pretty new to iis7 myself)
sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 08, 2010 01:15 PM|LINK
Thanks for your quick feedback... but it doesn't work either ... do you have that for rewrite ? I wonder if iis allow me wildcard :/
<rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" />
sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 10:07 AM|LINK
Hi
sorry just a last question, i dont get why it doesnt work for me ....
Just to know , do you have iis7?? if yes did you do something on it ...?
cuz it looks like my iis look for te folder instead of changing the url ...
Thanks
http://localhost/Ecommerce/Anniversary-Balloons-d3/
<div> </div>sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 10:29 AM|LINK
Hi tried your CustomTransformWithUrlRewriterNet solution.
But it seems to come from IIS7 cuz it doesn't work either.
http://forums.iis.net/t/1154026.aspx
rtpHarry
All-Star
56620 Points
8958 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 10:35 AM|LINK
Yes I have this working on an IIS7 server and I didnt set anything special up.
I have extensionless url rewrites working as well as in www.example.com/manufacturer/
I was talking to somebody yesterday about setting this up on IIS7 and I wrote a little guide for them to go with my IIS6 urlrewriter.net article:
I just noticed that you are not specifying the assembly when you setup the add httpmodule line in iis7 web.config:
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
should be
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 10:44 AM|LINK
Otherwise my Application Pool is set as ASP.NET v4.0 Classic ??? u too
???
thanks for this i will check ur link
sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 10:58 AM|LINK
sunnyshiny06
Member
69 Points
122 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 11:55 AM|LINK
sniiif
Ive tried to update it online but i've the same error ... so its not my iis but my code :/
http://onceuponatimejohanna.com/AppliSolVerte-p8/
rtpHarry
All-Star
56620 Points
8958 Posts
Re: HttpModules Rewrite with IIS 7
Feb 12, 2010 12:26 PM|LINK
No I am running .net 3.5 which I believe would mean a 2.0 app pool?