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


Post New Web Links

WebRequest/WebClient: This header must be modified using the appropriate property problem

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :.NET Framework
 

I need to do a programmatically originated post using WebRequest or WebClient (doesnt really matter)

When I try to a header into any of the instanciated object, i got the error:
This header must be modified using the appropriate property problem

I have read a couple posts by Microsoft's VS2005/2008 developers. They claim to fix the issue caused when using some restricted headers with the WebRequest class which throw the "This header must be modified using the appropriate property" error :

1- use WebClient instead of webrequest... but webclient still fires that exception if resricted headers are used.

2- dotnet 3.5 with VS2008 should have a new method for WebRequest called: AddWithoutValidate() which --according to MS-- allows the addition of restricted header type to WebRequest.... However that method does not exists in VS 2008.

 

Any ideas or solution for overcoming this problem ??

 

Thanks




View Complete Post


More Related Resource Links

What's the problem in my javascript's code to get ClientID Property?

  

 

 Hi all.

I wirte a simple java script code to get ClientID of controls on the webform. The code is like:

<script type="text/javascript" language="javascript">

var butt = $find("<%= Button1.ClientID %>");

alert(butt);

 <script>

But when i run it , i have a problem. The probmel is:

 

Server Error in '/' Application.

The Controls collection cannot be modified because t

header and footer problem

  

Hiii Coders,

I have made all the pages of my wesite centered aligned using the following code in masterpage:

<body background="Images/bg2.gif">
    <form id="form1" runat="server">
    <table style="width:960px; margin-left:auto; margin-right:auto; background-color:White;">
my content
</table>

No doubt, it works fine ut still it shows body background from top and bottom. I don't want to show it from top and bottom. Means that website should be centered align from left and right sides only whereas should display my form/webpage fron top and bottom.

plz helpand provide some code snippet

thanx and regards 
 


Problem in Custom Control Unable to find Control To Validate Property

  

I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'

 

My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

body tag's header and footer problem

  
Hiii Coders, I have made all the pages of my wesite centered aligned using the following code in masterpage:<body background="Images/bg2.gif"> <form id="form1" runat="server"> <table style="width:960px; margin-left:auto; margin-right:auto; background-color:White;"> my content </table> No doubt, it works fine ut still it shows body background from top and bottom. I don't want to show it from top and bottom. Means that website should be centered align from left and right sides only whereas should display my form/webpage fron top and bottom. plz helpand provide some code snippet thanx and regards 

System.Net.Mail e-mail header info problem

  
I'm new to using the system.net.mail class and I'm having trouble with a small program I'm writing.  I use my SendMessage() to send an email public static void SendMessage(string msg)         {             System.IO.File.Copy(mySource + msg, destSource + msg);             MailMessage mail = new MailMessage("from@me.com", "to@you.com, msg, "");                        Attachment attch = new Attachment(destSource + msg, "text/plain; format=flowed;reply-type=original"); //content-type text/plain                                   mail.Attachments.Add(attch);                                  MessagingCenter.client.Send(mail);             mail.Dispose();         } However, the email sent

Need help to solve header selection problem in accordion

  
Hello  friends I have created Accordion control from database. so basically in the header section I have bind categories and in the panel Bind subcategories. basically now it's working fine. but the important thing what i have to do is if i selected a category on that time it's showing me subcategory in the accordion. but at the same time i have to show subcategory  on another page.As well as i have to keep selected header true. Now not getting how to show subcategory on another page and as well as how to keep selected header true.Please HElp me solve this issue.Thanks And RegardsOmkar.

Items collection cannot be modified when the DataSource property is set.

  
I am having two listboxes which performs Drag and Drop, when i drag and leave on to second listbox I am getting the error: Items collection cannot be modified when the DataSource property is set. code: using     System; using     System.Collections.Generic; using     System.ComponentModel; using     System.Data; using     System.Drawing; using     System.Linq; using     System.Text; using     System.Windows.Forms; namespace     WindowsControlEx8 {     public partial class Form1 : Form {     List<Colors> colors = new List<Colors>() {     new Colors{colorName="Red"},     new Colors{colorName="Green"},     new Colors{colorName="Black"},     new Colors{colorName="White"},     new Colors{colorName="Orange"} };         public Form1() { InitializeComponent();   }     private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { }     private void button1_Click(object sender, EventArgs e) {     var c = from c1 in colors     select c1.colorName; listBox1.DataSource = c.ToList();   } &nb

Linq to SQL - Association Property Name problem

  
Is it possible to specifiy a custom property name for a foreign key association in Linq to Sql? For example, if you have an "Order" class that has a "Customer" EntityRef, that's fine.  But what if instead of myOrder.Customer you wanted the property name to be myOrder.PreferredCustomer.sqlmetal and the designer are both always using the table name as the Property name.  So myOrder.Customer is the only option I have, other than hacking through the generated file.You can change the storage option of the association attribute, but that pertains to the underlying member, NOT the public property.Thanks.

Printing Problem :- Style.Overflow property in Firefox

  

Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll bar

Now if after print i give divMain.style.overflow = "Auto" OR divMain.style.overflow = "Scroll", still the scroll bar doesn't come and if it comes then its inactive. I am unable to see the complete data on the page after the print is taken.

The problem is not coming in I.E and the full data with scroll bar is recovered in I.E.

Please help me how to get the normal page with full data and scroll bar after printing in Firefox. 

 

Thanks,

Manuj


Printing Problem :- Style.Overflow property in Firefox

  

Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll

Problem with property editor of a web user control

  

Hi,

I created an asp.net user control with a property named 'TabList' , the property is visible when I place my control on a page, the default editor for this property was a simple text box, but I needed a DropDownList for editing the TabList property of my control, so I added following code to implement it:

<Category("Navigation Bar"), Editor(GetType(DropDownList), GetType(System.Drawing.Design.UITypeEditor)), Description("List of Tabs"), DefaultValue("SHISHIR WAHI")> Public Property TabList() As String
        Get
            Return _tablist
        End Get

        Set(ByVal value As String)
            _tablist = value
        End Set
    End Property

The Category() and DefaultValue() are working fine but Editor() and Description() are not, what could be the problem?

Please help.


2010 Collection class syntax/property problem

  
I converted a project from 2008 to 2010 to be able to use the TPL.

I've updated the compile target to .NET 4. Everything seems good, including the .NET 4 specific TPL stuff...except that:

Parallel.ForEach(MyClassCollection.Cast(Of MyClass), (Sub(ANYTHING As MYClass) ANYTHING.MySubRoutine()))

Gives the following as a syntax error:

Error 2 'Cast' is not a member of 'Microsoft.VisualBasic.Collection'. C:\Users\jeff\Documents\Visual Studio 2010\Projects\MyProject\MyProject\RunLoop.vb 229 34 MyProject

Any ideas?

Thanks.

Problem retrieving bit colum with sqldatareader for vb class property

  

 I have a vb class that reads a single row of data from an SQL view. I want to add a property to it that will expose the value of a new bit field. But whatever I do my class always returns the value "false".

What am I doing wrong?

       Public ReadOnly Property IsPublished() As Boolean
            Get
                Return valPublished
            End Get
        End Property


Here's the relevant line from my datareader:
        Me.valPublished = Convert.ToBoolean(theObjectReader("Authorised"))Authorised is my bit field. I have tried it with and without the "ConvertToBoolean" statement.
When I response write the value of the property for rows where this field is true, it always shows false.

Any ideas?


ExecuteReader problem in web form: Connection-property not initialized

  

I changed my data source from an access-db to a sql-server, now i still have to fix some problems Undecided

When I want to load a value from a sql-database into my web form (to display a default value), I get an ExecuteReader error ("Connection-property not initialized").

I dont know where to set the connection property in my code.

Dim con As New System.Data.SqlClient.SqlConnection()
Dim myCommand As New System.Data.SqlClient.SqlCommand
Dim SqlCon As String = "Data Source=blablabla\SQLEXPRESS;Initial Catalog=Bill;Persist Security Info=True;User ID=xxx;Password=password"
con.ConnectionString = SqlCon
Dim reader As System.Data.SqlClient.SqlDataReader = myCommand.ExecuteReader() 

The error occurs in the last line. Do I have to set the connection property in the SqlCon string?


Categories: 
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