I'm trying to play around with URL rewrites and can't get it to work.
I have a URL,
http://localhost/CToastWebsite/Rooms.aspxand want to write it ashttp://localhost/CToastWebsite/RoomsAnd I have another URL,
http://localhost/CToastWebsite/Rooms.aspx?type=CreateRoomand want to write ithttp://localhost/CToastWebsite/Rooms/CreateRoom.
How would I go about doing this?
I have tried and my CSS and images do not work even though I use /styles/styles.css with URL http://localhost/CToastWebsite/Rooms.aspx/CreateRooms. Is this the correct way of using a URL like this?
I'm stuck, and I have searched for articles, but I can't find anything that is easy to follow and get the CSS and images to work.
EDIT
I have set up urlrewritingnet.net, but I am having problems. I set a rule such as:
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >
<rewrites>
<add name="Rewrite" virtualUrl="^~/Rooms"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Rooms.aspx"
ignoreCase="true" />
</rewrites>
</urlrewritingnet>
So I want /rooms.aspx to change to /rooms, but the page keeps displaying /rooms.aspx.
Session state error now
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.
I have added the tag in the web.config file in <system.web>:
<sessionState mode="InProc" timeout="20" cookieless="UseCookies" />
and I have set EnableSessionState="true" in the page directive.
Solution
I followed Stack Overflow question Error using session in IIS 7 to make the session state work again.