Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
QuestionReading XML from a web service Pin
JD8612-Jun-12 7:01
JD8612-Jun-12 7:01 
AnswerRe: Reading XML from a web service Pin
PIEBALDconsult12-Jun-12 7:45
mvePIEBALDconsult12-Jun-12 7:45 
GeneralRe: Reading XML from a web service Pin
JD8612-Jun-12 8:30
JD8612-Jun-12 8:30 
GeneralRe: Reading XML from a web service Pin
JD8612-Jun-12 8:35
JD8612-Jun-12 8:35 
AnswerRe: Reading XML from a web service Pin
jschell12-Jun-12 9:03
jschell12-Jun-12 9:03 
GeneralRe: Reading XML from a web service Pin
JD8612-Jun-12 9:33
JD8612-Jun-12 9:33 
AnswerRe: Reading XML from a web service Pin
JD8612-Jun-12 10:32
JD8612-Jun-12 10:32 
QuestionURL Rewriting does not work after Publishing Code in ASP.NET,C# VS 2005 Pin
masterprogrammertech12-Jun-12 5:00
masterprogrammertech12-Jun-12 5:00 
We are having issue with URL Rewriting, when we publish the code (in VS 2005).
In unpublished code it worked fine. But When we publish the code in following two cases:
1) By Putting the Global.asax file in root folder.
2) By putting the Global.asax file in App_Code Folder.

In First case, URL Rewriting is done for the first time, but when any post back is Occurred due to any Button click, the page is refreshed, and the Button click event is not called.

In Second case, every thing works fine except the URL Rewriting part, now URL is not rewritten on any page. But all postbacks occurred correctly.

We are currently unable to findout the reason for this behaviour. May be we are using session to store the value of lastURL (in Application_AcquireRequestState of Global.asax), and it could be possible that in unpublished code session is accessible but not in published code (any ideas). The code is given below(just for suggestion):

C#
RewriteURL.Cs code:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace WebURL
{
    /// 
    /// Summary description for RewriteURL
    /// 
    public class RewriteURL : IHttpModule
    {
        ManageCatSubCat objCat = new ManageCatSubCat();

        public RewriteURL()
        {
            //
            // TODO: Add constructor logic here
            //
        }


        public void Init(HttpApplication application)
        {
            application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
        }

        public void Dispose()
        {
        }

        private void Application_Disposed(Object source, EventArgs e)
        {

        }

        void Application_BeginRequest(object sender, EventArgs e)
        {
            string fullOrigionalpath = HttpContext.Current.Request.Url.ToString().ToLower();

            if (fullOrigionalpath.EndsWith("/scrapoffers/selloffer"))
            {
                HttpContext.Current.RewritePath("~/sellofferdefault.aspx?OfferType=SellOffer");
            }
}
}
}



Global.asax code:

<%@ Application Language="C#" %>



<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup

    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }
    
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
    }


    void Application_AcquireRequestState(object sender, EventArgs e)
    {
        //Session is Available here
        string strLastURL = "";
        string fullOrigionalpath = HttpContext.Current.Request.Url.ToString().ToLower();
        
        if (fullOrigionalpath.Contains(".aspx"))
        {

                       

            if (fullOrigionalpath.Contains("/sellofferdefault.aspx?offertype=selloffer") && fullOrigionalpath != strLastURL)
            {
                HttpContext.Current.Session["LastAccessURL"] = fullOrigionalpath;
                HttpContext.Current.Response.Redirect("~/ScrapOffers/SellOffer");
            }
            
            
            
        }
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        
    }

    void Session_End(object sender, EventArgs e) 
    {

    }
       
</script>



In web.config file:
<pre lang="c#"><system.web>
		
		<httpHandlers>
			<remove verb="*" path="*.asmx"/>
			<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
			<remove verb="*" path="js.axd"/>
			<add verb="*" path="js.axd" type="DC.Web.HttpCompress.CompressionHandler,DC.Web.HttpCompress"/>
		</httpHandlers>
		<httpModules>
			<add name="rewriteurl" type="WebURL.RewriteURL"/>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			<add name="HttpCompressModule" type="DC.Web.HttpCompress.HttpModule,DC.Web.HttpCompress"/>
		</httpModules>
	</system.web>




How is how we are Publishing the Code:
Open the web project in VS 2005 and then Going to Build Menu and Click Publish Website submenu and giving target Location and Checking all the 4 checkboxes :1) Allow this Precompiled site to be updatable
2)Use fixed naming and single page assemblies.
3)Enable Strong Naming on Precompiled assemblies.
And when you will check this checkbox then Selecting the radio button Use a Key Container and Key Container text box is empty. And then checking the below checkbox.
4)Mark assemblies with allowpartiallyTrustedCallerAttribute(APTCA)
QuestionPossible Bug in VS 2010 IDE Pin
Steve Harp12-Jun-12 4:27
Steve Harp12-Jun-12 4:27 
AnswerRe: Possible Bug in VS 2010 IDE Pin
PIEBALDconsult12-Jun-12 4:45
mvePIEBALDconsult12-Jun-12 4:45 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Steve Harp12-Jun-12 5:26
Steve Harp12-Jun-12 5:26 
AnswerRe: Possible Bug in VS 2010 IDE Pin
Eddy Vluggen12-Jun-12 8:48
professionalEddy Vluggen12-Jun-12 8:48 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Steve Harp13-Jun-12 3:47
Steve Harp13-Jun-12 3:47 
AnswerRe: Possible Bug in VS 2010 IDE Pin
Eddy Vluggen13-Jun-12 3:57
professionalEddy Vluggen13-Jun-12 3:57 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Steve Harp13-Jun-12 4:07
Steve Harp13-Jun-12 4:07 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Eddy Vluggen13-Jun-12 4:51
professionalEddy Vluggen13-Jun-12 4:51 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Steve Harp13-Jun-12 7:41
Steve Harp13-Jun-12 7:41 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Eddy Vluggen13-Jun-12 8:01
professionalEddy Vluggen13-Jun-12 8:01 
GeneralRe: Possible Bug in VS 2010 IDE Pin
Steve Harp13-Jun-12 8:20
Steve Harp13-Jun-12 8:20 
QuestionIssue with Click-once Deployment Pin
McCombi12-Jun-12 0:23
McCombi12-Jun-12 0:23 
Questionc# Pin
fadi1321112-Jun-12 0:09
fadi1321112-Jun-12 0:09 
AnswerRe: c# Pin
Pete O'Hanlon12-Jun-12 1:03
mvePete O'Hanlon12-Jun-12 1:03 
AnswerRe: c# Pin
Dave Kreskowiak12-Jun-12 2:18
mveDave Kreskowiak12-Jun-12 2:18 
JokeRe: c# PinPopular
markovl12-Jun-12 2:55
markovl12-Jun-12 2:55 
GeneralRe: c# Pin
Keith Barrow12-Jun-12 4:38
professionalKeith Barrow12-Jun-12 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.