UIPAB with ASP.NET 2.0 – our solution
By rickvdbosch
- 2 minutes read - 258 wordsAs I posted earlier we had some trouble with upgrading the UIPAB to be used in a ASP.NET 2.0 Web Application Project. Eventually, we solved the problem and life was good. Almost a week ago I received a mail through my blog from someone looking for the solution. So here we go…
We changed a few lines in the UIPAB WebFormViewManager. The problem was in determining the application path in the method ‘RedirectToNextView’. Here the applicationpath was all garbled up, which caused the redirect not to work. We implemented a property to return the right applicationpath:
<TD>
<PRE>1<BR />2<BR />3<BR />4<BR />5<BR />6<BR />7<BR />8<BR />9<BR />10<BR />11<BR />12<BR />13<BR />14<BR />15<BR />16<BR />17<BR />18<BR />19<BR />20<BR />21<BR />22<BR />23<BR />24<BR />25<BR />26<BR />27</PRE>
</TD>
<br />
<TD>
<PRE> <FONT size="2"><SPAN>private</SPAN> <SPAN>string</SPAN> applicationPath = <SPAN>null</SPAN>;</FONT></PRE>
<PRE><FONT size="2"> </PRE></FONT>
The above returns the path we need. It’s not a perfect example of defensive programming, but that’s not the intention of this post ;). We added the sessionstring because the application in which we used the UIPAB kept the session id in the URL. The RedirectToNextView method now looks like this:
<TD>
<PRE>1<BR />2<BR />3<BR />4<BR />5<BR />6<BR />7<BR />8<BR />9<BR />10<BR />11<BR />12<BR />13<BR />14<BR />15<BR />16<BR />17<BR /> </PRE>
</TD>
<br />
<TD>
<PRE><SPAN> <SPAN>private</SPAN> <SPAN>void</SPAN> RedirectToNextView(<SPAN>string</SPAN> previousView, ViewSettings viewSettings)<BR /> {<BR /> <SPAN>try</SPAN><BR /> {<BR /> <SPAN>if</SPAN> (previousView == <SPAN>null</SPAN>)<BR /> {<BR /> HttpContext.Current.Response.Redirect(ApplicationPath <SPAN>+</SPAN> viewSettings.Type, <SPAN>true</SPAN>);<BR /> }<BR /> <SPAN>else</SPAN><BR /> {<BR /> HttpContext.Current.Response.Redirect(ApplicationPath <SPAN>+</SPAN> viewSettings.Type, <SPAN>false</SPAN>);<BR /> }<BR /> }<BR /> <SPAN>catch</SPAN> (System.Threading.ThreadAbortException)<BR /> {<BR /> }<BR /> }</SPAN></PRE>
</TD>