.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Weird behaivor with streamReader

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net


THe situations is this:

I have to call to a site which returns me a string with some data.

My problem is it seems that the calling to that url is not working unless I perform an action after that call, for example send an email or write at event log or whatever.

this is the code

WebClient cliente = new WebClient();

Stream data2 = cliente.OpenRead(StartURLMPWC + "InviteMemberToProject.jsp?username=" + userWebCenter + "&password=" + pwdWebCenter + "&projectname=" + nombreProyecto + "&usermembername=" + myReader.GetString(1) + "&approver=1&sdkcall=1");

reader = new StreamReader(data2);                          
 string approvementDetails = reader.ReadToEnd();

I dont know why, but that doesn't work unless I (for example) send an email after those lines

any ideas??

is any better way to call to that url without using WebClient and openRead?

View Complete Post

More Related Resource Links

Weird security configuration error message


Recently something has gone wrong with our website so that whenever you try to access an aspx file, it shows the following error:


Server Error in '/RALSWeb' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: 'RalsWeb'.

Source Error:

Line 256:                <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257:                <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258:                <add assembly="*"/>
Line 259:            </assemblies>

Weird "string;#" in combobox


Ok, while I am digging and digging myself into the world that's called Sharepoint I come to the next challenge.


I have two lists Projects List and Project Issues. They both have an id field (which is not the ID field of the record) and a title. I created two calculated fields for both of the tables which combines the title and the number for displaying in other pages.



Projects List:

ProjectID: 2008-001

Project Name: First Project in 2008

Display Name (which is the calculated field): 2008-001 First Project in 2008


The calculated field formula is: =[ProjectID]&" "&[Project Name]

The field returns a string.


I also have a Worksheet list where my workers have to fill in their working hours. In this list I have two lookup fields. O

Weird problem in Detailsview - Dropdownlist in



I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>

Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"

IE 7 Weird error


NOTE: In firefox or Chrome not an issue, but in IE it just has become one.


<span  id="titleGannAngles" runat="server" >Title goes here</span>

Javascript global variable

var ogannangles = '<%= titleGannAngles.ClientID %>';

Js code in a function

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

It renders like this:      document.getElementById('ctl00_ContentPlaceHolder1_Chart_Volume1_Chart_Objects_Settings1_Chart_Objects_Edit1_titleGannAngles').innerHTML="Object: Gann Angle,Grid,Arcs"+des;

YET IE 7 gives me the error on this line:

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

That object is NULL or not an object ???

Why ???

binary serialize weird error

i got this class, when i wanna serialize it, i keep getting error System.Runtime.Serialization.SerializationException was unhandled by user code   Message=Type 'System.Linq.Enumerable+WhereSelectListIterator`2[[Data.Models],[System.Int32, mscorlib, Version=, ...' in Assembly 'System.Core, Version=, ... is not marked as serializable. [Serializable] public class XXX : ... { public IEnumerable<int> CardFilters { get; set; } //public void RequeryCardFilters() //{ //} public void RequeryCardFilters() { this.CardFilters = null; ... //IEnumerable<Data.Models> var rslt = RFDataViewModelFactory.GetReportCardFilters(this.Identifiers, this.PostcodeFrom, this.PostcodeTo, this.LastContactBefore, this.RecontactBy, this.SelectedCardType); ... IEnumerable<int> rsltIds = from i in rslt select i.Id; } } you can see inside the RequeryCardFilters(), i only play with 3 data/var, 1 of them is local public prop, the other 2 are local var. If you remark this out, and just use an empty method, it worked fine. what can cause the serialization to fail? IFormatter formatter = new BinaryFormatter(); MemoryStream memStrem = new MemoryStream(); formatter.Serialize(memStrem, myObj);

weird problem of using multithread to querying sql server

Hi,   I'm working on a project which needs query the sql server many times to pull the statistics info. the whole process is very slow. so, I'm trying to use the multithread to do the work. However, I noticed one weird thing:   In the program, I need pull, say 10000 documents from the sql to local PC, then can do some analysis. Each document size is different. If I used 1 thread, say for document A whose size is 5MB, it will take about 20 seconds for the SELECT query returns the result. Now, if I used 10 threads, I found that it will take much longer time for SQL to return the SELECT query for document A, say maybe 90 seconds. I got the run time for the SELECT from the sql profiler.   Overall, the performance of multithread is very similar to single thread even I use 50 threads. I used the same code for another project, the only difference is that that project scrapes data from website and this project gets data from sql. The other project works very well when using multithread. so, I'm kind of believe that the multithread part code works fine.    Could this because some settings on sql server? some bandwidth limitation? any clues?   any help/suggestion will be appreciated.   thanks reader      

a very weird error wsDualHttpBinding...HELP !!!!!

hi all, Created a wcf application,and now enhancing its features ,makes me to use wsDualHttpBinding as callbacks are included.Before my application worked well on BasicHttpBinding,but nw on wsDualHttp its giving an old error when i run my client and try to connect or cal a wcf method.. that error is: "HTTP could not register URL http://+:80/Temporary_Listen_Addresses/4f044c47-0774-4358-bfca-7fe1fcbfadf2/ because TCP port 80 is being used by another application." i referred 100 of forums n articles but in vain.I also tried including ClientBaseAddress in app.config on client side.,but no use....i really dnt understand what the problem is n how do i solve it..plz do give me some clear solutions so dat i proceed with my wrk.. Waiting for response Mumtaz Mumtaz Surani

Weird behavior

I've made this "Minify" class that inherits from MemoryStream and I want to use it to minimise the amount of whitespace in for example css and javascript files. To begin with I'm not doing anything complex just a simple replace.using System;using System.Collections.Generic;using System.Linq;using System.IO;using System.Text;using System.Web;using System.Text.RegularExpressions;namespace Output{    public class Minify : MemoryStream    {        private Stream stream = null;        public Minify(Stream stream)        {            this.stream = stream;        }        public override void Write(byte[] buffer, int offset, int count)        {            string content = UTF8Encoding.UTF8.GetString(buffer);            content = LimitWhitespace(content);            stream.Write(UTF8Encoding.UTF8.GetBytes(content), offset, UTF8Encoding.UTF8.GetByteCount(content));        } &nbs

Weird Date vs Date/Time issue using a calculated column

I'm attempting to use the fab 40 attendance template. I don't need the time to show - Im able to hide that on the forms with jquery (endusersharepoint.com thank you!!) I WAS ATTEMPTING to create a calculated column called Start Date where the formula simply reads '=[Start Time]' When it's set to display 'Date Only' the date is off by a day. If I switch it to 'Date & Time' I get the correct date. Huh?

Report Builder 3.0 scorecard behaves weird

Hi, I have a balanced scorecard created in Report Builder 3.0. It has four dimensions and I´m able to drill down on them to be able to see more specific targets. Some of the targets are in turn connected to a drillthrough report. This scorecard is deployed to Sharepoint 2007 and have worked fine (as far as I know) for the last 3-4 months. Yesterday, SQL Server 2008 R2 was upgraded from beta Enterprise version to the "real" version - Standard edition. Report Server and all other reports seem to be working just as they did before, but the mentioned scorecard seem to have som sort of bug problem. Initially, in collapsed mode, it looks alright. Once I start drilling down and expanding the different dimensions some weird problems emerge. For example, sometimes when I expand all four dimensions the indicators (showing red, yellow or green) and trend arrows dissappear on the dimension and target level in the bottom of the scorecard. Sometimes, the indicators and arrows show up on the wrong "level", e.g. a dimension gets a red indicator (and white background, as the lower level targets have. The dimension rows have blue background) that should be shown on the target (i.e. lower) level. When I start collapsing again, it sometimes starts looking good again. The problems all seem to originate from the indicators and trend arrows that are i

Weird memory problem

Hi all.   I am quite new to c#, I have the following code segments and both of them cause the program to throw System.ComponentModel.Win32Exception indicating that memory is not enough. Both of the code segments is in a form.   while(true) { System.Drawing.Graphics g = this CreateGraphics(); System.Drawing.BufferedGraphicsContext c = System.Drawing.BufferedGraphicsManager.Current; System.Drawing.BufferedGraphics b = c.Allocate( g, new System.Drawing.Rectangle(0,0,3000, 3000) ); } while(true) { this.Controls.Clear(); this.Controls.Add( new Label() ); }   My question is shouldn't the resource created handled automatically by garbage collector ?   Thanks a lot.  

Weird Issue with the MOSS Search : FileExtension metadata object type instead of string

Hello, We 've got a strange issue with the search and especially with the FileExtension metadata. when we make a query on the search engine, we receive for the FileExtension metadata an unexcpected result. here is a printscreen showing the issue. http://cid-53eee937847a625e.photos.live.com/self.aspx/Public/Untitled.jpg as you can see the Type of the FileExtension is object and it should be string and I checked the type of the object and it's System.String[] the element at the index 0 contains the value! what's wrong ? thx in advance

Weird Issue with the MOSS Search

Hello, We 've got a strange issue with the search and especially with the FileExtension metadata. when we make a query on the search engine, we receive for the FileExtension metadata an unexcpected result. here is a printscreen showing the issue. http://cid-53eee937847a625e.photos.live.com/self.aspx/Public/Untitled.jpg as you can see the Type of the FileExtension is object and it should be string and I checked the type of the object and it's System.String[] the element at the index 0 contains the value! what's wrong ? thx in advance      

EXPERT: avoiding weird refresh behavior of Eval method in a tabpanel

I have this control in a detailsview:<asp:DropDownList ID="ddlEventStartDay" SelectedValue='<%#Cdate(Eval("startdate")).Day %>' CssClass="textbox" runat="server">    <asp:ListItem Value="1" Text="01" />    <asp:ListItem Value="2" Text="02" />    <asp:ListItem Value="3" Text="03" />    <asp:ListItem Value="4" Text="04" />    <asp:ListItem Value="5" Text="05" />    <asp:ListItem Value="6" Text="06" />    <asp:ListItem Value="7" Text="07" />    <asp:ListItem Value="8" Text="08" />    <asp:ListItem Value="9" Text="09" />    <asp:ListItem Value="10" Text="10" />    <asp:ListItem Value="11" Text="11" />    <asp:ListItem Value="12" Text="12" />    <asp:ListItem Value="13" Text="13" />    <asp:ListItem Value="14" Text="14" />    <asp:ListItem Val

weird Rating Control behavior

Hi folks! :)I have Rating control on my page. The page is a subpage of nested master page. On that page is updatepanel and wizard with TemplatedWizardStep inside it and inside TemplatedWizardStep is Rating Control.Master.Page -> NestedMaster.Page -> Content.PageI allso have googlemap inside that wizard(on different step) so i need to register google initialize() for it to work.So by registering googlemap like example below Rating Control freezes. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "initialize()", True) End Sub But if i include script tags in string like example below, Rating Control does not freeze. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "<script>initialize()</script>", False) End Sub Everythnig works, but i wonder, WHY :) Why is Rating Control freezing in sample1?

Weird problem with session cookie

Hi all,I'm having a weird problem with my web application, and I can't find the solution to it.I'm using a Java applet to read some data from an electronic ID. This applet posts its captured data to a HttpHandler class and stores the data back in some session variables. It all works smoothly, unless in some cases.Every time a do a new publish to the webserver or the website isn't touched for some time. There is a problem with the session.The applet can't find a session cookie, and so it crashes.I did some tests and indeed, the cookie ("ASP.NET_SessionId") does not exists. But it seems that other session variables (user login, etc) are working fine.To make sure that the cookie for the session ID is readable from the applet I do the following in the global.asax: Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started Dim isSessionFound As Boolean = False If Response.Cookies.Count > 0 Then For Each s As String In Response.Cookies.AllKeys If s = "ASP.NET_SessionId" Then Response.Cookies("ASP.NET_SessionId").HttpOnly = False isSessionFound = True 'just for test End If Next End If End SubI tried to do something with the isSessionFound, wh

Weird query plan problem where total is over 100%

Hi All, I am looking at the query plan for a stored procedure and I am seeing things like 1400% on the execution plan, the stored procedure I believe is called within a loop quite a lot of times, but I don’t quite understand why the percentages will be over 100 for one section of the execution plan. Any explanation for this ? Thanks in advance.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend