HttpHandlers and HttpModuleshttp://forums.asp.net/27.aspx/1?HttpHandlers+and+HttpModulesExtending the ASP.NET Framework through HttpModules and HttpHandlers.Fri, 10 May 2013 03:22:53 -0400urn:uuid:00000000-0000-0000-0000-000000000027urn:uuid:00000000-0000-0000-0000-000005395449http://forums.asp.net/p/1906390/5395449.aspx/1?Upload+file+using+HttpPostedFile+in+webserviceUpload file using HttpPostedFile in webservice &lt;div&gt; <p>Hello All,</p> <p>I am getting file path from android device in asp.net webservice. Now through that path, i want to upload file on asp.net server.</p> <p>I can't use server control FileUplaod in webservice so i found some details about HttpPostedFile but i don't have any idea about how to use it...</p> <p>So please anyone tell me how to use it ???</p> &lt;/div&gt; 2013-05-16T05:44:58-04:002013-05-16T05:44:58.64-04:00urn:uuid:00000000-0000-0000-0000-000005346853http://forums.asp.net/p/1894050/5346853.aspx/1?How+to+configure+httpModule+so+all+errors+go+through+it+How to configure httpModule so all errors go through it? <p>How do I configure my httpModule so that all errors go through it?</p> <p>Here's how I have it configured in my web.config (it handles begin_request, authorize_request, etc. just not application_error):</p> <pre class="prettyprint">in &lt;system.webServer&gt; I have &lt;modules runAllManagedModulesForAllRequests=&quot;true&quot;&gt; &lt;add name=&quot;My Module Name&quot; type=&quot;namespace.name&quot;/&gt; ... &lt;/modules&gt;</pre> <p>Like I said, the application.BeginRequest and other events fire fine. However, when I get an error not handled in other code, the application.error event does not fire.</p> <p>Any help TIA,</p> 2013-03-28T21:54:12-04:002013-03-28T21:54:12.077-04:00urn:uuid:00000000-0000-0000-0000-000005388846http://forums.asp.net/p/1904860/5388846.aspx/1?Redirect+from+handlers+page+to+aspx+pageRedirect from handlers page to .aspx page <p>Hi All,</p> <p>&nbsp;I would like to share my problem. I have a .ashx page, from this page I would like to redirect to .aspx page but I am not able to do it. So, I am trying to call the .aspx page using SQL Server. If there is a chance to redirect .ashx to .aspx page I will be comfortable or else I need how to open a .aspx page using SQL. So please try to help me.. and the other issue is when I am trying to debug the highlighted code(/*xxx*/) while debugging &nbsp;I am getting an error. Please help me.. Its urgent...</p> <p>Below is my code…</p> <p>Thanks in advance…</p> <p></p> <pre class="prettyprint">public class Upload : IHttpHandler, IRequiresSessionState { public Upload() { } #region IHttpHandler Members public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) { string pagename = System.Web.HttpContext.Current.Session[&quot;pagename&quot;].ToString(); string strpath = context.Server.MapPath(context.Request.ApplicationPath); } if (pagename == &quot;userdownload&quot;) { DataSet ds_selfiles = asignfiles.select_filestatus(&quot;0&quot;, System.Web.HttpContext.Current.Session[&quot;emailid&quot;].ToString(), Convert.ToDateTime(DateTime.Now)); //string mtname = System.Web.HttpContext.Current.Session[&quot;emailid&quot;].ToString(); //string hospname = System.Web.HttpContext.Current.Session[&quot;hospname&quot;].ToString(); //string Docname = System.Web.HttpContext.Current.Session[&quot;docname&quot;].ToString(); for (int j = 0; j &lt; context.Request.Files.Count; j&#43;&#43;) { HttpPostedFile uploadFile = context.Request.Files[j]; string path = context.Server.MapPath(context.Request.ApplicationPath &#43; &quot;/MT Documents&quot;); if (!Directory.Exists(Path.Combine(path, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)))) { Directory.CreateDirectory(Path.Combine(path, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;))); //string path1 = Path.Combine(path, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)); } string path1 = Path.Combine(path, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)); DataSet ds = Hospitaldetails.create_hospitalname(&quot;0&quot;, System.Web.HttpContext.Current.Session[&quot;emailid&quot;].ToString()); int rowcount = ds.Tables[0].Rows.Count; for (int b = 0; b &lt; rowcount; b&#43;&#43;) { if (!Directory.Exists(Path.Combine(path1, (ds.Tables[0].Rows[b].ItemArray[0].ToString())))) { Directory.CreateDirectory(Path.Combine(path1, (ds.Tables[0].Rows[b].ItemArray[0].ToString()))); } string path2 = Path.Combine(path1, (ds.Tables[0].Rows[b].ItemArray[0].ToString())); if (!Directory.Exists(Path.Combine(path2, (ds.Tables[0].Rows[b].ItemArray[1].ToString())))) { Directory.CreateDirectory(Path.Combine(path2, (ds.Tables[0].Rows[b].ItemArray[1].ToString()))); } string uploadPath = Path.Combine(path2, (ds.Tables[0].Rows[b].ItemArray[1].ToString())); string uploadPath1 = context.Server.MapPath(context.Request.ApplicationPath &#43; &quot;/Final Documents&quot;); if (!Directory.Exists(Path.Combine(uploadPath1, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)))) { Directory.CreateDirectory(Path.Combine(uploadPath1, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;))); //string path1 = Path.Combine(path, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)); } string uploadPath2 = Path.Combine(uploadPath1, DateTime.Now.Date.ToString(&quot;dd MMM yyyy&quot;)); // DataSet ds = Hospitaldetails.create_hospitalname(System.Web.HttpContext.Current.Session[&quot;emailid&quot;].ToString()); // int rowcount = ds.Tables[0].Rows.Count; // for (int b = 0; b &lt; rowcount; b&#43;&#43;) // { if (!Directory.Exists(Path.Combine(uploadPath2, (ds.Tables[0].Rows[b].ItemArray[0].ToString())))) { Directory.CreateDirectory(Path.Combine(uploadPath2, (ds.Tables[0].Rows[b].ItemArray[0].ToString()))); } string uploadPath3 = Path.Combine(uploadPath2, (ds.Tables[0].Rows[b].ItemArray[0].ToString())); if (!Directory.Exists(Path.Combine(uploadPath3, (ds.Tables[0].Rows[b].ItemArray[1].ToString())))) { Directory.CreateDirectory(Path.Combine(uploadPath3, (ds.Tables[0].Rows[b].ItemArray[1].ToString()))); } string uploadPath4 = Path.Combine(uploadPath3, (ds.Tables[0].Rows[b].ItemArray[1].ToString())); string uploadPath5 = context.Server.MapPath(context.Request.ApplicationPath &#43; &quot;/MT Docs&quot;); // string uploadPath2=Path.Combine(path2, (ds.Tables[0].Rows[b].ItemArray[1].ToString())); strpath &#43;= &quot;~&quot; &#43; uploadPath; strpath &#43;= &quot;~&quot; &#43; uploadPath4; strpath &#43;= &quot;~&quot; &#43; uploadPath5; if (uploadFile.ContentLength &gt; 0) { uploadFile.SaveAs(Path.Combine(uploadPath, uploadFile.FileName)); uploadFile.SaveAs(Path.Combine(uploadPath4, uploadFile.FileName)); uploadFile.SaveAs(Path.Combine(uploadPath5, uploadFile.FileName)); string strFileExtension = System.IO.Path.GetExtension(uploadFile.FileName); object fileName = Path.Combine(uploadPath, uploadFile.FileName); object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; /* Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); Microsoft.Office.Interop.Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); oWordDoc.Activate(); Int32 count = oWordDoc.Characters.Count - 1; oWordDoc.Close(ref missing, ref missing, ref missing);*/ String m = uploadFile.FileName; String extnsn = Path.GetExtension(m); System.Web.HttpContext.Current.Session[&quot;name&quot;] = Path.GetFileNameWithoutExtension(m); DataSet ds_docnames = uploadfiles.select_docname(m); if (ds_docnames.Tables[0].Rows.Count == 0) { asignfiles.insert_uploaded_docmnt_details(ds_selfiles.Tables[0].Rows[0].ItemArray[1].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[2].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[3].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[4].ToString(), Convert.ToDateTime(ds_selfiles.Tables[0].Rows[0].ItemArray[5].ToString()), ds_selfiles.Tables[0].Rows[0].ItemArray[6].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[7].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[8].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[9].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[10].ToString(), ds_selfiles.Tables[0].Rows[0].ItemArray[11].ToString(), uploadFile.FileName, &quot;Transcribed&quot;, 0, Convert.ToInt32(&quot;00&quot;), Convert.ToInt32(&quot;00&quot;)); } } } if (ds_selfiles.Tables[0].Rows.Count != 0) { int i = asignfiles.update_filestatus_MT(&quot;Transcribed&quot;, ds_selfiles.Tables[0].Rows[0].ItemArray[2].ToString()); //asignfiles.insert_finishedtime(&quot;0&quot;, ds_selfiles.Tables[0].Rows[0].ItemArray[2].ToString(), Convert.ToDateTime(DateTime.Now.ToString(&quot;hh:mm tt&quot;)), &quot;Transcribed&quot;); asignfiles.update_asignedtime(&quot;0&quot;, ds_selfiles.Tables[0].Rows[0].ItemArray[2].ToString(), Convert.ToDateTime(DateTime.Now.ToString(&quot;hh:mm tt&quot;))); HttpContext.Current.Response.Write(strpath &#43; &quot;/user_download.aspx&quot;); } }</pre> <p><br> <br> </p> 2013-05-09T07:23:32-04:002013-05-09T07:23:32.997-04:00urn:uuid:00000000-0000-0000-0000-000005376600http://forums.asp.net/p/1902025/5376600.aspx/1?Issue+with+downloading+files+using+ashxIssue with downloading files using .ashx <p>Hi,</p> <p>I have a handler that downloads binary files stored in a database. Typically this works well, but occasionally some of my users will report that they are no longer able to download files. Restarting the browser, will fix it at least temporarily. I figure it must be something with my code as I cna open up a different website, and download a file from there just fine, while not being able to download from my site. I have also debugged with Fiddler, and I can see the ashx handler being called, the File name is returned etc, but the download wont start.</p> <p>Below is the code on button click:</p> <pre class="prettyprint">function ViewDocument(DocumentID) { window.location = &quot;/DocumentHandler.ashx?documentID=&quot; &#43; DocumentID; }</pre> <p>and the handler (truncated mime types for space)</p> <pre class="prettyprint"> Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim MIMEType As String Dim DocumentID As Integer = context.Request.Params("documentID") Dim myConn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("conn").ConnectionString) Dim cmd As New SqlCommand("SELECT * FROM [Docs] WHERE [Doc_ID] = @Doc_ID", myConn) cmd.Parameters.AddWithValue("@Doc_ID", DocumentID) myConn.Open() Dim rd As SqlDataReader = cmd.ExecuteReader If rd.Read Then Select Case rd.GetString(8).ToLower Case "gif" MIMEType = "image/gif" Case "xlsx" MIMEType = "application/vnd.ms-excel" Case "zip" MIMEType = "application/zip" Case Else 'Invalid file type Exit Sub End Select Dim FileName As String = rd("FileName") Dim ext As String = System.IO.Path.GetExtension(FileName) context.Response.Buffer = False context.Response.ClearContent() context.Response.ClearHeaders() context.Response.ContentType = MIMEType.ToString context.Response.AddHeader("Content-Disposition", "attachment; filename=" &amp; FileName &amp; "." &amp; rd("DocType")) context.Response.BinaryWrite(rd("Doc")) context.Response.Flush() End If rd.Close() myConn.Close() End Sub</pre> <p>Thanks,</p> <p>Chris</p> <p><br> <br> </p> 2013-04-26T19:57:18-04:002013-04-26T19:57:18.873-04:00urn:uuid:00000000-0000-0000-0000-000004383457http://forums.asp.net/p/1672865/4383457.aspx/1?HttpHandler+and+assembly+problemHttpHandler and assembly problem <p>Hi, I have created a HttpHandler for link redirecting and manualy compiled it, as the visual web developer express doesn,t create an assembly for development purposes. I have placed it in bin folder of the application, along with the web site assembly. I also have added to web.config section:</p> <p>&lt;httphandlers&gt;</p> <p>&lt;add verb=&quot;*&quot;, path=&quot;*&quot;, type=&quot;Webapplication1.PrzekierowanieSkrotu, Skroc&quot; /&gt;</p> <p>&lt;/httphandlers&gt;</p> <p>However, at compilation I receive an error stating that class PrzekierowanieSkrotu couldn't be loaded from assembly Skroc. <pre class="prettyprint">using System; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace WebApplication1 { public class PrzekierowanieSkroto : IHttpHandler { /// &lt;summary&gt; /// You will need to configure this handler in the web.config file of your /// web and register it with IIS before being able to use it. For more information /// see the following link: http://go.microsoft.com/?linkid=8101007 /// &lt;/summary&gt; #region IHttpHandler Members public bool IsReusable { // Return false in case your Managed Handler cannot be reused for another request. // Usually this would be false in case you have some state information preserved per request. get { return true; } } public void ProcessRequest(HttpContext context) { //utworzenie uchwytu do skróty string skrot; //zapisanie skrótu w uchwycie skrot = context.Request.FilePath; //pobranie linku przypisanego do skrótu string link; //otwieram polaczenie do bazy - korzystam z metod z klasy Skracacz SqlConnection conn = new SqlConnection(); conn = polaczenie(); conn.Open(); //polaczenie jest juz otwarte - teraz korzystam z procedury, która zwróci link do przekierowania SqlCommand command = new SqlCommand(&quot;ZWROC_LINK&quot;, conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(&quot;@SKROT&quot;, SqlDbType.VarChar).Value = skrot; SqlDataReader reader = command.ExecuteReader(); //odczutuje link z bazy reader.Read(); link = reader[0].ToString(); //na koniec przekierowuję na pobrana stronę context.Response.Redirect(&quot;http://&quot; &#43; link); //to koniec :) } protected SqlConnection polaczenie() { string connectionString = ConfigurationManager.ConnectionStrings[&quot;baza&quot;].ConnectionString; //dane połączenia do bazy SqlConnection conn = new SqlConnection(connectionString); //obiekt połączenia return conn; } #endregion } }</pre> </p> <p>&nbsp;</p> <p><span size="2" face="Consolas" color="#0000ff" style="color:#0000ff; font-family:Consolas; font-size:x-small"><span size="2" face="Consolas" color="#0000ff" style="color:#0000ff; font-family:Consolas; font-size:x-small"><span size="2" face="Consolas" color="#0000ff" style="color:#0000ff; font-family:Consolas; font-size:x-small"></p> <p>I don't know what king of mistake I am doing, I wonder if you could help me. My assembly Skroc is built only from one c# file PrzekierowanieSkrotu.cs. I compiled it to Skroc.dll using csc from .net 2.0 and my project also have in properties .net 2.0.</p> <p>Any help would be appreciated</p> <p>&nbsp;</p> <p>Regards</p> <p>Bartek</p> </span></span></span><span size="2" face="Consolas" style="font-family:Consolas; font-size:x-small"><span size="2" face="Consolas" style="font-family:Consolas; font-size:x-small"></span></span> <p>&nbsp;</p> <p>&nbsp;</p> <p></p> &nbsp; 2011-04-14T18:36:48-04:002011-04-14T18:36:48.137-04:00urn:uuid:00000000-0000-0000-0000-000004830412http://forums.asp.net/p/1769103/4830412.aspx/1?Put+link+to+httphandler+ashx+delivering+Javascript+into+CompositeScript+of+ScriptManagerPut link to httphandler (ashx delivering Javascript ) into CompositeScript of ScriptManager <p>Hi,</p> <p>I can run a .ashx delivering javascript successfully when referenced through a &lt;asp:ScriptReference&gt; inside a ScriptManager.</p> <p>However when I put a &lt;CompositeScript&gt; around it it will no longer be found:</p> <pre class="prettyprint">&lt;asp:ScriptManagerProxy runat=&quot;server&quot; ID=&quot;Proxy2&quot;&gt; &lt;CompositeScript&gt; &lt;Scripts&gt; &lt;asp:ScriptReference Path=&quot;MyHandler.ashx&quot; NotifyScriptLoaded=&quot;false&quot; /&gt; .....</pre> <p>Error (translated): &quot;The web ressource ... was not found.&quot;</p> <p>Any idea how to reference it correctly when using composite?</p> <p></p> <p>Thank you!</p> <p></p> 2012-02-13T19:35:07-05:002012-02-13T19:35:07.593-05:00urn:uuid:00000000-0000-0000-0000-000005381044http://forums.asp.net/p/1903023/5381044.aspx/1?From+a+handler+can+I+make+an+asynchronous+call+to+a+wcf+service+method+and+not+wait+on+the+service+From a handler, can I make an asynchronous call to a wcf service method and not wait on the service? <p>So I have this IIS handler that recieves a bit of data, and writes it to sql. &nbsp;This happens pretty quick.</p> <p>Ive seen a few examples of an asp.net page making an&nbsp;asynchronous call to a wcf service, but the async methods still had to finish before the page was rendered to the client.</p> <p>However, I want to return after I save my data and NOT wait until the service method completes.</p> <p>How do I do this?</p> 2013-05-01T14:54:42-04:002013-05-01T14:54:42.433-04:00urn:uuid:00000000-0000-0000-0000-000005376297http://forums.asp.net/p/1901963/5376297.aspx/1?The+specified+module+could+not+be+found+Exception+from+HRESULT+0x8007007E+The specified module could not be found. (Exception from HRESULT: 0x8007007E) <p><span style="font-family:'Verdana','sans-serif'; font-size:9pt">Hello all,</span></p> <p><span style="font-family:'Verdana','sans-serif'; font-size:9pt">i am integrating the a java code dll to my C# application.&nbsp; following are the steps i did :</span></p> <p><span style="font-family:'Verdana','sans-serif'; font-size:9pt">I </span><span style="font-family:'Verdana','sans-serif'; font-size:9pt">have created a windows application and add all the dll's in the bin folder. When I run the application it works fine but which I try to run the same code in web application with all dll </span>reference,<span style="font-family:'Verdana','sans-serif'; font-size:9pt">&nbsp;it giving me the error &quot;The specified module could not be found. (Exception from HRESULT: 0x8007007E)&quot;. </span></p> <p><span style="font-family:'Verdana','sans-serif'; font-size:9pt">can some one please help to how to resolve this issue.</span></p> <p>please refer the stack trace :</p> <h2><em>The specified module could not be found. (Exception from HRESULT: 0x8007007E)</em></h2> <p><span><span><strong>Description: </strong>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br> <br> <strong>Exception Details: </strong>System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)<br> <br> <strong>Source Error:</strong></span></span></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><pre class="prettyprint">An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</pre></td> </tr> </tbody> </table> <p><span><span><br /><strong>Stack Trace:</strong></span></span></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td> <pre>[FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +127 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46 [ConfigurationErrorsException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53 System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33 System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155 </pre> </td> </tr> </tbody> </table> 2013-04-26T14:01:25-04:002013-04-26T14:01:25.353-04:00urn:uuid:00000000-0000-0000-0000-000005378963http://forums.asp.net/p/1902579/5378963.aspx/1?IHttpHandler+and+WebHandler+still+cause+Session+State+Load+and+SaveIHttpHandler and WebHandler still cause Session State Load and Save <p>I'm trying to figure out why this is occuring.</p> <p>I don't want this extra hit and am not specifying IReadonlySessionState or IRequiresSessionState in my class. &nbsp;Any help would be appreciated!</p> <pre class="prettyprint">public class TextHandler: IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.Write(&quot;Sample Output&quot;); } public bool IsReusable { get { return true; } } }</pre> <p><br> <br> </p> 2013-04-29T17:25:19-04:002013-04-29T17:25:19.867-04:00urn:uuid:00000000-0000-0000-0000-000005376295http://forums.asp.net/p/1901962/5376295.aspx/1?+error+while+building+web+application+that+uses+org+apache+qpid+messaging+dll+ error while building web application that uses org.apache.qpid.messaging.dll &lt;div class=&quot;votingouterbox&quot;&gt; &lt;div class=&quot;voting&quot;&gt;Hello All&lt;/div&gt; &lt;div class=&quot;voting&quot;&gt;<img class="icon voteup" title="You cannot vote on your own post" alt="You cannot vote on your own post" src="http://i1.social.s-msft.com/globalresources/Images/trans.gif?cver=0%0d%0a">&lt;/div&gt; &lt;div class=&quot;voting&quot;&gt;I am trying to build an IIS/C# web application that uses org.apache.qpid.messaging.dll but getting the error below. <br> <br> The version of QPID I am using is &quot;qpid-cpp-x64-VS2010-3.1.0.2&quot;. <br> <br> Any ideas on what is missing to enable this to work? <br> <br> Thanks in advance <br> Jitendra Mishra<br> <br> <br> Server Error in '/' Application. <br> -------------------------------------------------------------------------------- <br> <br> Could not load file or assembly 'org.apache.qpid.messaging.dll' or one of its dependencies. The specified module could not be found. <br> Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br> <br> Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'org.apache.qpid.messaging.dll' or one of its dependencies. The specified module could not be found. <br> <br> Source Error: <br> <br> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. &nbsp; <br> <br> Stack Trace: <br> <br> <br> [FileNotFoundException: Could not load file or assembly 'org.apache.qpid.messaging.dll' or one of its dependencies. The specified module could not be found.] <br> &nbsp; &nbsp;System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) &#43;0 <br> &nbsp; &nbsp;System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) &#43;567 <br> &nbsp; &nbsp;System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) &#43;192 <br> &nbsp; &nbsp;System.Reflection.Assembly.Load(String assemblyString) &#43;35 <br> &nbsp; &nbsp;System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) &#43;123 <br> <br> [ConfigurationErrorsException: Could not load file or assembly 'org.apache.qpid.messaging.dll' or one of its dependencies. The specified module could not be found.] <br> &nbsp; &nbsp;System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) &#43;11566480 <br> &nbsp; &nbsp;System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() &#43;485 <br> &nbsp; &nbsp;System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() &#43;79 <br> &nbsp; &nbsp;System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) &#43;334 <br> &nbsp; &nbsp;System.Web.Compilation.BuildManager.CallPreStartInitMethods() &#43;280 <br> &nbsp; &nbsp;System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) &#43;1167 <br> <br> [HttpException (0x80004005): Could not load file or assembly 'org.apache.qpid.messaging.dll' or one of its dependencies. The specified module could not be found.] <br> &nbsp; &nbsp;System.Web.HttpRuntime.FirstRequestInit(HttpContext context) &#43;11698928 <br> &nbsp; &nbsp;System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) &#43;141 <br> &nbsp; &nbsp;System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) &#43;4867637&nbsp;&lt;/div&gt; &lt;/div&gt; 2013-04-26T14:00:31-04:002013-04-26T14:00:31.35-04:00urn:uuid:00000000-0000-0000-0000-000005373563http://forums.asp.net/p/1901323/5373563.aspx/1?HttpHandler+Not+Called+in+ServerHttpHandler Not Called in Server <p>dear Frds</p> <p>I created a HttpHandler by using C# Website project to</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; as User open image(Email-Bidy_img.JPG) &amp; called Hanlder SimpleHandler to saved email to DB</p> <p>SimpleHanlder.CS insode Add_code folder</p> <p>public class SimpleHandler : IHttpHandler<br> {<br> <br> #region IHttpHandler Members<br> public SimpleHandler()<br> {<br> //<br> // TODO: Add constructor logic here<br> //<br> }</p> <p>bool IHttpHandler.IsReusable<br> {<br> get { return true; }<br> }<br> void IHttpHandler.ProcessRequest(HttpContext context)<br> {</p> <p>&nbsp; &nbsp; &nbsp; &nbsp;Some Coding are here for Email saving to Db</p> <p>}</p> <p></p> <p>}<br> #endregion<br> }</p> <p></p> <p>in web.config file i configure it by using the</p> <p>&lt;httpHandler&gt;&lt;add verb=&quot;*&quot; &nbsp;path=&quot;Email-Body-img.jpg&quot; type=&quot;SimpleHandler&quot;/&gt;&lt;/httpHnadler&gt;</p> <p></p> <p>Its run absultly fine in local but as i am trying to run this on server its dosen't call my Handler Named <br> SimpleHandler&quot;</p> <p></p> <p>Whats should i have to do for runing this Handler in Server.</p> 2013-04-24T10:48:12-04:002013-04-24T10:48:12.037-04:00urn:uuid:00000000-0000-0000-0000-000005374950http://forums.asp.net/p/1901626/5374950.aspx/1?HttpHandler+to+display+data+dynamically+on+pageHttpHandler to display data dynamically on page <p>I am building a dynamic website. I want to display data on page and that data will come from database. I have also created master page for site.I want to display data in particular content place holder.The page url should look like abc.aspx?id=1.I just want to display data in label.</p> <p>Please help , its urgent.</p> 2013-04-25T12:25:42-04:002013-04-25T12:25:42.37-04:00urn:uuid:00000000-0000-0000-0000-000005374794http://forums.asp.net/p/1901597/5374794.aspx/1?Can+you+give+example+of+using+HttpModule+Can you give example of using HttpModule ? <p>To understand clearly for what HttpModule need I want I real task example in which it can help.</p> <p>I can give you example of using httphandler :</p> <p>1. We can processing and then caching images on C#.</p> <p>We goind on url. htttp://site/getimage.asx?url=imageurl</p> <p>then C# handler code will be executed.</p> <p>It load image, resize it, cahce and return</p> <p>2. We can generate rss for specific language.</p> <p>example</p> <p>htttp://site/rss.asx?url=en</p> <p>rss will be generated for this language.</p> <p>I want such example for HttpModule</p> 2013-04-25T10:06:17-04:002013-04-25T10:06:17.157-04:00urn:uuid:00000000-0000-0000-0000-000005374480http://forums.asp.net/p/1901531/5374480.aspx/1?http+request+and+responsehttp request and response <p>Hi, Friends,</p> <p>I want to ask one thing,</p> <p>when I run one web service method , that will be one Http request to server ?</p> <p>I want to know how long server take time to response for one http request ?</p> <p>just now, I run 3 web service methonds within every one second by using Ajax Timer control, </p> <p>what I understand is browser request 3 times to server every one second, is that right?</p> <p>&nbsp;pls suggest me</p> <p></p> <p>regards</p> 2013-04-25T06:19:54-04:002013-04-25T06:19:54.923-04:00urn:uuid:00000000-0000-0000-0000-000005366234http://forums.asp.net/p/1899590/5366234.aspx/1?How+to+write+htaccess+of+websiteHow to write .htaccess of website <p>Hi!,</p> <p></p> <p>I have a website that has some page in simple html and some are in .aspx. The website is hosted on window based server.&nbsp;</p> <p>I want to resolve canonical issue so need .htaccess file that redirects non www to www version. I am new to .htaccess file.</p> <p>My website is <a href="http://.com">http://brilliantseotechnologies.com</a>&nbsp;and I want it to redirect to <a href="http://www.com">http://www.brilliantseotechnologies.com</a></p> <p></p> <p>Regrads,</p> <p>Shashikant</p> <p></p> <p></p> 2013-04-17T05:23:34-04:002013-04-17T05:23:34.04-04:00urn:uuid:00000000-0000-0000-0000-000005372695http://forums.asp.net/p/1901130/5372695.aspx/1?what+is+the+purpose+of+handler+what is the purpose of handler ? <p>purpose of handler is use to show the images ?</p> <p>i store the image into database by binary format , when i nid to bound bu using datalist control why it cant display ?</p> <p>i nid to use handler? pass the ID?</p> 2013-04-23T15:38:31-04:002013-04-23T15:38:31-04:00urn:uuid:00000000-0000-0000-0000-000005368762http://forums.asp.net/p/1900190/5368762.aspx/1?Why+does+HttpWorkerRequest+fail+during+HttpRuntime+ProcessRequest+after+a+NET+2+0+to+NET+4+0+upgrade+Why does HttpWorkerRequest fail during HttpRuntime.ProcessRequest after a .NET 2.0 to .NET 4.0 upgrade? <p>Sorry if this is the wrong forum, if it is, please point me to the correct one, and I'll happily post there.</p> <p>I am upgrading our application, which has an internal webserver, from .NET 2.0 to .NET 4.0.</p> <p>I am handling a request with an object&nbsp;HttpListenerWorkerRequest, that extends the HttpWorkerRequest class, and creates a request which GetRawUrl() returns a Url in the format of http://localhost:82/Default.aspx</p> <p>In .NET 2.0, sending this to HttpRuntime.ProcessRequest(httpListenerWorkerRequest) works without issue, however in .NET 4.0, I get a web page with the nothing but the text &quot;Bad Request&quot; on it.</p> <p>Cracking open HttpRuntime, I can see that Bad Requests are thrown from&nbsp;ProcessRequestInternal(HttpWorkerRequest wr), a private method that tries to build an HttpContext.</p> <p>I tried this myself:&nbsp;</p> <pre class="prettyprint">try { //what's going on? hcontext = new HttpContext(workerRequest); } catch(Exception e) { //Debugging break point here }</pre> <p>Pre-update (.NET 2.0), the context is created, post-update, however, (.NET 4.0), I get an Exception stating that</p> <pre class="prettyprint">The relative virtual path 'http://localhost:82/Default.aspx' is not allowed here</pre> <p>Posting the above on Stackoverflow, it was suggested I was hitting the XSS breaking change in 4.0, however adding &nbsp;requestValidationMode="2.0" (as below), hasn't helped.</p> <pre class="prettyprint">&lt;configuration&gt;<br />...<br /><br /> &lt;system.web&gt; &lt;httpRuntime requestValidationMode="2.0" /&gt; &lt;/system.web&gt;<br /><br />...<br /><br />&lt;/configuration&gt;&nbsp;</pre> <p>What has changed in .NET to cause this, and what can I do to get around it?</p> 2013-04-19T04:13:11-04:002013-04-19T04:13:11.837-04:00urn:uuid:00000000-0000-0000-0000-000005359160http://forums.asp.net/p/1897157/5359160.aspx/1?HttpHandler+AuthenticationHttpHandler Authentication Hi, I am using an httphandler to upload files for my website. I have authentication in my IIS 7 set to &quot;allow&quot; ASP.NET Impersonation. I have also set &quot;Authenticated User&quot;. My website uses the Forms Authentication. When I try to upload a file, at the end of the upload, I receive a request for authentication message. Does anyone know why I am getting this and how to get around it? I want to use the credentials of the currently logged-in user. Thanks. 2013-04-10T21:03:32-04:002013-04-10T21:03:32.693-04:00urn:uuid:00000000-0000-0000-0000-000005367177http://forums.asp.net/p/1899810/5367177.aspx/1?Does+Windows+Platform+server+supports+htaccess+Does Windows Platform server supports .htaccess <p>hi,</p> <p>I am new to .htaccess and want to resolve canonical issue for a website that is <strong>hosted on Windows based server</strong> with&nbsp;</p> <pre class="prettyprint">serverType: Microsoft-IIS/7.5</pre> <p></p> <p></p> 2013-04-17T17:33:17-04:002013-04-17T17:33:17.083-04:00urn:uuid:00000000-0000-0000-0000-000005361489http://forums.asp.net/p/1897739/5361489.aspx/1?Can+find+my+classes+Can find my classes? <p>All sorry for the cross posting but it seems like I have started it in the wrong place.</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/5c7b3077-5c81-4483-a75a-6c9bb38f6f3c/">http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/5c7b3077-5c81-4483-a75a-6c9bb38f6f3c/</a></p> <p>Thoughts?</p> <p>--Original Post--</p> <p>All I have a strange one here but should be easy for you.&nbsp; I have built a generic handler to provide a backend to a web page.&nbsp; When I run it locally, as in the VS environment, everything works fine.&nbsp; But when I deploy the application it says it can't find a class, in this case User.</p> <p>The project is just a web site based on the HTML5 broilerplate.&nbsp; My code, except for the handlers, is in App_Code.&nbsp; So the user class is in \App_Code\Model\User.cs.&nbsp; I am not using NameSpaces yet.</p> <p>When I run the application the host returns a compiler error:</p> <pre class="prettyprint">S0246: The type or namespace name 'User' could not be found (are you missing a using directive or an assembly reference?</pre> <p>When I run it locally, as in the VS environment, everything works fine.</p> <p>Any thoughts?</p> <p>the app is at http://www.seitmc.com/Demo/ and thanks for any help you may be able to offer.</p> <p>JD</p> <hr> <p>Thanks JD LinkedIn: <a href="http://www.linkedin.com/in/johndsanders">www.linkedin.com/in/johndsanders</a></p> <p>--UPDATE--</p> <p>I just moved all of my model classes into the LoginHandler.ashx and now it runs.&nbsp; What gives?</p> <p>--UPDATE 2--</p> <p>Added namespace to the classes and put them back into App_Code\Model\ and added a using statement to the handlers.&nbsp; The system immediately stopped working again.</p> <p>This is crazy.</p> <p>Any thoughts?</p> 2013-04-12T18:31:25-04:002013-04-12T18:31:25.7-04:00