Problem in Redirect of url - Sharepoint / MOSS 2007 web application

Topics: Developer Forum, Project Management Forum, User Forum
Oct 12, 2010 at 3:15 PM

Dear All,

I am again posting my problem, requesting you to please give me some directions on how to solve the problem :

I am having one webapplication (SharePoint/MOSS 2007) and I using this Ionics Isapi rewrite filter to lowercase my url's, Since i am using Redirect method to lowercase my url's and its working fine, but If I am trying to add/edit any item in the list/document library its not changing into first time into lowercase and thus reposting the page again, which is causing problem to users.

Is their any code or any option like an if-else condition through which we can stop this redirection code to work and only work when we need to trigger our redirection code.

Thanks,

Rahul Gulati

 

Coordinator
Oct 14, 2010 at 10:45 PM

I don't understand the problem you're having. I think it might be related to language and syntax.

Maybe you could post some specific examples of the unwanted behavior you're describing. Also it would be nice to see the IIRF rule you are using.

 

Oct 15, 2010 at 3:40 PM
Edited Oct 15, 2010 at 3:58 PM

Thanks for the reply, This is the script that I wrote :

##########################
#Redirect Script
#Rahul Gulati
##########################

#RewriteLog file
#RewriteLogFile c:\temp\iirfs

#To check configuration of IIRF URL Rewriter
#StatusUrl /iirfStatus
RewriteEngine ON


#RewriteFilter priority set high

RewriteFilterPriority HIGH


# Explictly added to don't rewrite any request that ends with one of these extensions
# Because of the [L] flag, any (or GIF image, etc) will not be processed by any rules appearing later in this ini file.
RewriteRule (.+\.)(php|jpg|png|jpeg|gif|ttf|sql|txt|htm|zip|css)$   -   [L]

# Don't rewrite anything that starts with /newform.aspx,editform.aspx or dispform.aspx
# Again, because of the [L] flag, URLs that match here will not be processed by any other rules  appearing later in this ini file.

RedirectRule ^/NewForm.aspx?rootfolder=/(.*)$   -   [L]

RedirectRule ^/NewForm/(.*)$ - [L]

RewriteCond %{nawinapp107.enterprisenet.org}  ([^\.]+)\NewForm.aspx$ - [L]

RewriteCond %{HTTP_HOST} ^www\.domain1\.com$  [OR]

RewriteCond %{HTTP_HOST} ^www\.domain2\.com$

RewriteRule ^/(?!NewForm.aspx)(?!.*\?rootfolder=$)(.*)$


# Rule for lowercase
RedirectRule ^/(.*[A-Z].*)\.aspx$  /#L$1#E.aspx

I am again explaining the issue here :

When I am trying to create new item in the list of the MOSS 2007 (Sharepoint), the url is not changing into lowercase  as per the script rule - #rule for lowercase (you can see above),

Example -

https://abc.xyz.com/Support/Connections/Lists/Polls/NewForm.aspx?RootFolder=%2Fsupport%2Fconnections%2FLists%2FPolls&Source=https%3A%2F%2Fintranet%2Enielsen%2Ecom%2Fsupport%2Fconnections%2FLists%2FPolls%2FAllItems%2Easpx

as per the redirect rule it should be turned into lowercase and so on :

https://abc.xyz.com/support/connections/lists/polls/newform.aspx?rootfolder=%2Fsupport%2Fconnections%2FLists%2FPolls&Source=https%3A%2F%2Fintranet%2Enielsen%2Ecom%2Fsupport%2Fconnections%2FLists%2FPolls%2FAllItems%2Easpx

but it is not happening so when we are submitting the form its changing the url to lowercase and due to that all the data submitted got refreshed, which ultimately causing the issue, so I would like to write that rule which prevents this issue.(you can see the rule with name : # Don't rewrite anything that starts with /newform.aspx,editform.aspx or dispform.aspx and its beyond)

Please let me know if we can write some rule which will ultimately stop this rewrite if newform.aspx,editform.aspx comes into url path.

Please let me know if you have any queries.

Regards,

Rahul Gulati

 

 

Coordinator
Oct 18, 2010 at 10:09 PM

ok, some suggestions for you. I see what appear to be at least 3 errors in your ini file.  In one rule, you have no replacement pattern at all.  Also, you have a reference in a RewriteCond like %{nawinapp107.enterprisenet.org} . This is the syntax you would use for a server variable, but I'm pretty sure nawinapp107.enterprisenet.org is not the name of a server variable.  Also, you have an [L] modifier on a RewriteCond directive; this isn't legal. 

So, my first suggestion:  turn on the StatusUrl directive, and also actually CHECK the status url, to verify that the syntax in your IIRF.ini file is legal.   You'll find that it is not.  Then you need to fix those syntax errors.

My second suggestion is to turn on IIRF logging, and examine the log file for a given URL, to understand why the shift to lowercase is not happening. This step may not be necessary, after you fix all the syntax errors in the ini file.   

Good luck.

Oct 19, 2010 at 11:36 AM

Thanks a lot for your suggestions, I will follow up and get back to you.

On the further note actually the code that I wrote is basic a POC version and the code written for mentioned below area is just a trial to see on how I am going to stop the redirection :

# Don't rewrite anything that starts with /newform.aspx,editform.aspx or dispform.aspx
# Again, because of the [L] flag, URLs that match here will not be processed by any other rules  appearing later in this ini file.

RedirectRule ^/NewForm.aspx?rootfolder=/(.*)$   -   [L]

RedirectRule ^/NewForm/(.*)$ - [L]

RewriteCond %{nawinapp107.enterprisenet.org}  ([^\.]+)\NewForm.aspx$ - [L]

RewriteCond %{HTTP_HOST} ^www\.domain1\.com$  [OR]

RewriteCond %{HTTP_HOST} ^www\.domain2\.com$

RewriteRule ^/(?!NewForm.aspx)(?!.*\?rootfolder=$)(.*)$

Thanks a lot one more time, I will get back to you soon.

Rahul Gulati

 

Coordinator
Oct 23, 2010 at 6:14 PM

Rahul, regarding that proof of concept, this line:

RewriteCond %{nawinapp107.enterprisenet.org}  ([^\.]+)\NewForm.aspx$ - [L]

...is nonsense, for the reasons I stated in my previous message.  You can't use [L] on a RewriteCond, and there is no server variable named nawinapp107.enterprisenet.org.

 

Also, this line:

RewriteRule ^/(?!NewForm.aspx)(?!.*\?rootfolder=$)(.*)$

... is incomplete.  Be sure to fix those syntax errors before you "test" anything.

Nov 2, 2010 at 9:38 AM

Thanks, Let me check and get back to you...

Rahul Gulati

 

 

May 16, 2012 at 2:01 PM
So...

The answer was never posted here, so I'll go ahead and bring this issue back up.  I may be able to describe it better than the previous poster.

 

The correct question is:

is it possible to change which request lifecycle event Ionics processes it's redirects on?

Take a look below at the information I've copied from the MetaBase for both Ionics and Sharepoint.  Specifically, notice the filter flags.  I know people have discussed before about making Ionics process priority "High" and then moving it to the top of the list. 

This doesn't actually work, and here is why:

Sharepoint is registering for the NotifyPreProcHeaders event... and is actually doing some of it's processing work there on that event.  This includes, but may not be limited to server.transfer implementation of the virtual _Layouts/ folder, or the little error page that is shown when you try to browse to a non-existent site in the site collection.  By the time Ionics gets the request in the NotifyUrlMap event (or NotifyAuthComplete) event, Sharepoint has already re-written the original request (if not completely hijacked it).

If we had an option in Ionics that allowed us to latch on (and process redirections) on the NotifyPreProcHeaders event, that would be really cool, and would allow us to finally step in front of Sharepoint once and for all.

This issue affects all versions of Ionics dealing with all versions of Sharepoint, and the examples I've seen of people claiming success with Sharepoint have all been limited and grounded in some kind of solution that only deals with the root of a site collection, not any URLs for a site in the collection (the "I fix SSL search" example, for example).

 

<IIsFilters Location ="/LM/W3SVC/1/Filters"
AdminACL="49634462f0000000a400000040000000114a7ddf570d89f6e3c994cc51fc3374a06ff2265ef375f71a75758c136b0eae4ed3410481120b1c9fb7bd67f74079e0234850519a1fe141c2ed22ec501ca9ceeac5382b238736ec38bc340c469c0b24e6c3a5cb837e27e16e4ce75f3c35d202016d1cb938809619c0d85496434c223b9fcec294e47282a8f667f10c00ed6d50c0c3ed6d2037eac340c2407b8c514d526eb46a8a0ed1f4d3364e504d5a517aa77827f0b77de0588669cdac88c9638f960fdf5b2c93b0f4728dec7db20a69889b570f1e830b574d4a81f6c3848ad1c15af977f19833e6142e2e4d88142eb01ff83992776a6ff77265"
FilterLoadOrder="Ionics Rewriter,stsfltr"
>
</IIsFilters>
<IIsFilter Location ="/LM/W3SVC/1/Filters/Ionics Rewriter"
FilterDescription="Ionic ISAPI Rewriting Filter (IIRF) v1.2.16 R8"
FilterFlags="NotifySecurePort | NotifyNonSecurePort | NotifyUrlMap | NotifyOrderHigh | NotifyAuthComplete"
FilterPath="D:\InetPub\IonicsIsapiReWriter\IsapiRewrite4.dll"
FilterState="1"
>
</IIsFilter>
<IIsFilter Location ="/LM/W3SVC/1/Filters/stsflt2"
FilterPath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin\stsfltr.dll"
FilterState="1"
>
</IIsFilter>
<IIsFilter Location ="/LM/W3SVC/1/Filters/stsfltr"
FilterDescription="Microsoft SharePoint"
FilterEnableCache="TRUE"
FilterFlags="NotifySecurePort | NotifyNonSecurePort | NotifyPreProcHeaders | NotifyOrderHigh | NotifyAuthComplete"
FilterPath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin\stsfltr.dll"
FilterState="1"
>
</IIsFilter>