|
|
I want to make the ASP.net project to distributable like windows setup project How to do it in asp project
|
|
|
|
|
|
We have something called 'Web Setup Project' in Setup and Deployment of New ... right?
|
|
|
|
|
i am using the below code to initialize the xmlhttprequest
try
{
obj = new XmlHttpRequest();
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
obj = new ActiveXObject("Msxml2.XMLHTTP");
}
}
it works fine in my system. but when accessed from network, the ajax features doesnt work. I have placed the code for ajax and some validation scripts in the .js file. The validation scripts works fine, but not the ajax scripts.
Please give me solution...
Regards,
Abul.
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
for qstn #1:
the ajax task is to check records in the db whether the name i entered in the textbox exists or not. it displays the message whether it exists or not. when accessed from network, during the event(i.e., on key press) an alert message box displays as "The page is accessing information that is not under its control. This poses a security risk. Do you want to continue ? "
for qstn #2:
if i give "yes" to the alert box, there's no response nor any error message. if i give no, still there is no response and it gives a javascript error as "Permission denied". This error is displayed at the bottom of the window and not as a textbox.
am i clear ?
|
|
|
|
|
Hello,
I wrote a ASP.NET 2.0 application using the Membership framework for security (roles and users). For debugging purposes I wrote some code in the index.aspx page to simply write out a list of all the roles that exist, using the good old Response.Write() method. I then published the site to my domain. However, the behavior of the index page is dependent on the running environment as follows:
IN VS 2005 ACCESSING LOCAL SQLSERVER: Runs great, all roles listed.
IN VS 2005 ACCESSING REMOTE (i.e. "LIVE") SQLSERVER: Runs great, all roles listed.
IN A WEB BROWSER VIEWING THE PUBLISHED APP: @$(&$#*!&$@*& No roles listed.
The really aggravating thing is that the login mechanism still works! If I try to access pages in subfolders protected by a local web.config with roles-based protection, I am denied access until I use the login page. However, once I'm logged in, even though I can access the protected pages both Roles.GetAllRoles() and Roles.GetRolesForUser() return an array of 0 elements.
I need the list of roles b/c my menu rendering routine is roles-based.
How is it even possible that Roles.GetAllRoles() turns up no results and yet the login and access protection mechanisms work perfectly?
Thanks for your help...
|
|
|
|
|
hi friends
i have six value in database.how to bind these values in array
can any one help me?
thanx
regards
saravanan
|
|
|
|
|
U can use List object for that...
Give some detail how u want to do that..
|
|
|
|
|
Please let me know how come all I get back from the server are only parameters (form values) that I am passing in my postURl string?
postURL - full url to the server and fileURL - full url to the local disk where file is stored
Private Function webrequest (ByVal postURL As String, ByVal fileURL As String) As String <br />
<br />
Dim sBoundary As String = Guid.NewGuid().ToString().Replace("-", "") <br />
<br />
Dim encoding As New ASCIIEncoding <br />
<br />
<br />
<br />
'*** Build the post message. <br />
<br />
Dim _StringBuilder As New StringBuilder <br />
<br />
With _StringBuilder <br />
<br />
.Append("--") <br />
<br />
.Append(sBoundary) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("Content-Disposition: form-data; name=\""id\"";") <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("8888888888") <br />
<br />
.Append("--") <br />
<br />
.Append(sBoundary) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("Content-Disposition: form-data; name=\""merch_id\"";") <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("1111111111") <br />
<br />
.Append("--") <br />
<br />
.Append(sBoundary) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("Content-Disposition: form-data; name=\""allow_dups\"";") <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("y") <br />
<br />
.Append("--") <br />
<br />
.Append(sBoundary) <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("Content-Disposition: form-data; name=\""" & "BATCH_FILE" & "\""; filename=\""" & fileURL & "\"";") <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append("Content-Type: application/octet-stream") <br />
<br />
.Append(vbCrLf) <br />
<br />
.Append(vbCrLf) <br />
<br />
End With <br />
<br />
Dim saPostHeaderBytes As Byte() = encoding.GetBytes(_StringBuilder.ToString()) <br />
<br />
<br />
<br />
'*** Build trailing boundary string as a byte array <br />
<br />
Dim saPostTrailingBoundaryBytes As Byte() = encoding.GetBytes(vbCrLf & "--" + sBoundary + vbCrLf) <br />
<br />
<br />
<br />
'*** Calculate the content length. <br />
<br />
Dim _FStream As New FileStream(fileURL, FileMode.Open, FileAccess.Read) <br />
<br />
Dim lLength As Long = saPostHeaderBytes.Length + _FStream.Length + saPostTrailingBoundaryBytes.Length <br />
<br />
<br />
<br />
'*** Create a HTTPWebRequest instance <br />
<br />
Dim _webreq As HttpWebRequest = DirectCast(WebRequest.Create(postURL), HttpWebRequest) <br />
<br />
_webreq.ContentType = "multipart/form-data; boundary=" + sBoundary <br />
<br />
_webreq.Method = "POST" <br />
<br />
_webreq.AllowWriteStreamBuffering = True <br />
<br />
_webreq.ContentLength = lLength <br />
<br />
Dim _reqStream As Stream = _webreq.GetRequestStream() <br />
<br />
<br />
<br />
''-- Write out our post header <br />
<br />
_reqStream.Write(saPostHeaderBytes, 0, saPostHeaderBytes.Length) <br />
<br />
<br />
<br />
' Write out the file contents to server in chunks of 10K <br />
<br />
Dim bytesRead As Integer 'how many bytes were uploaded <br />
<br />
Dim buffer() As Byte 'upload buffer <br />
<br />
'let buffer be the smallest of the two: filesize or 10K <br />
<br />
ReDim buffer(Math.Min(10240, _FStream.Length)) <br />
<br />
bytesRead = 1 'initialize to any number except 0 <br />
<br />
While bytesRead <> 0 <br />
<br />
'read bytes from file <br />
<br />
bytesRead = _FStream.Read(buffer, 0, buffer.Length) <br />
<br />
If bytesRead <> 0 Then 'make sure EOF is not reached <br />
<br />
<br />
<br />
'write bytes to remote server <br />
<br />
_reqStream.Write(buffer, 0, bytesRead) <br />
<br />
End If <br />
<br />
<br />
<br />
'flush streams <br />
<br />
_reqStream.Flush() <br />
<br />
_FStream.Flush() <br />
<br />
End While <br />
<br />
<br />
<br />
' Write out trailer to server <br />
<br />
_reqStream.Write(saPostTrailingBoundaryBytes, 0, saPostTrailingBoundaryBytes.Length) <br />
<br />
'close filestream <br />
<br />
_FStream.Flush() <br />
<br />
_FStream.Close() <br />
<br />
<br />
<br />
'close connection with server <br />
<br />
_reqStream.Flush() <br />
<br />
_reqStream.Close() <br />
<br />
<br />
<br />
'// Finally, we send the request and await the response. <br />
<br />
Dim _webresp As HttpWebResponse = _webreq.GetResponse <br />
<br />
If _webreq.HaveResponse Then <br />
<br />
Dim oStream As Stream = _webresp.GetResponseStream <br />
<br />
Dim oReader As StreamReader = New StreamReader(oStream) <br />
<br />
webrequest_5 = oReader.ReadToEnd <br />
<br />
oReader.Close() <br />
<br />
oStream.Close() <br />
<br />
End If <br />
<br />
_webreq = Nothing <br />
<br />
_webresp.Close() <br />
<br />
<br />
<br />
'dispose of unused objects <br />
<br />
GC.Collect() <br />
<br />
End Function
The code on the posting server is quite simple - just return everything... see below:
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
int loop1, loop2;<br />
<br />
System.Collections.Specialized.NameValueCollection collect =Request.QueryString; <br />
String[] arr1 = collect.AllKeys; <br />
for (loop1 = 0; loop1 < arr1.Length; loop1++) <br />
{<br />
String[] arr2 = collect.GetValues(arr1[loop1]);<br />
for (loop2 = 0; loop2 < arr2.Length; loop2++) <br />
{<br />
myResult += Server.HtmlEncode(arr1[loop1]) + " = " + Server.HtmlEncode(arr2[loop2]) + "<br>";<br />
}<br />
}<br />
<br />
myResult += " Total Received files " + Request.Files.AllKeys.Length + " <br>";<br />
<br />
foreach(string f in Request.Files.AllKeys) <br />
{<br />
HttpPostedFile file = Request.Files[f];<br />
file.SaveAs(Server.MapPath("ReceivedFiles") + "\\" + file.FileName);<br />
myResult += "received file " + file.FileName;<br />
} <br />
<br />
LblResult.Text += "Result<HR> " + myResult;<br />
<br />
}
|
|
|
|
|
hi everyone
I want to make a linkbutton in datagrid (in the first column of the datagrid) and put my code when i click this linkbutton
if any one have idea about that ..i will appreciate that if he/she told me about it
thanks in advance
haitham
|
|
|
|
|
in the property builder, in the columns tab, add one template column. then right click the grid, select that template column. drag and drop a linkbutton into the item template column.
|
|
|
|
|
first i would like to thanks about your attention
.it works with me successfully but establish a new column in the datagrid, i tried to bind the new column opened in datagrid (in design mode) with one of my columns when the datagrids is filled with data(in run mode) but the result is :it opened a new column (column[0]) on the left of my columns
thanks in advance
haitham
|
|
|
|
|
hi friends
my program is create chart dynamically from database values.
but i got error like this
Overload resolution failed because no accessible 'New' accepts this number of arguments.
this is my code
Dim objBitMap As New Bitmap(400, 200)
Dim objGraphics As Graphics
objGraphics = Graphics.FromImage(objBitMap)
objGraphics.Clear(Color.Gray)
objGraphics.DrawString("Charts using ASP.NET", New Font("Verdana", 12), Brushes.Black, New PointF(5, 5))
Dim MyConnection As SqlConnection
Dim connString As String
Dim ReaderObj As SqlDataReader
Dim MyCommand As SqlCommand
MyConnection = New SqlConnection (connstring) MyConnection.Open()
Dim sqlString As String
Dim i As String
sqlString = "Select count(products) as UnitPrice,suppliesId as suppliesId From Products"
'sqlString = "Select count(items) as itemtotal,year as year FROM Items "
MyCommand = New SqlCommand(sqlString, MyConnection)
ReaderObj = MyCommand.ExecuteReader()
Do While ReaderObj.Read()
objGraphics.FillRectangle(New SolidBrush(Color.Blue, (i * 35) + 15, 200 - ReaderObj("UnitPrice"), 20, ReaderObj("UnitPrice") + 5))
this line error
objGraphics.DrawRectangle(Pens.Black, (i * 35) + 15, 200 - ReaderObj("UnitPrice"), 20, ReaderObj(UnitPrice) + 5)
this line error
Loop
'Close objects
'drreader.Close()
MyConnection.Close()
objBitMap.Save(Response.OutputStream, ImageFormat.Gif)
can any one help me
regards
saravanan
|
|
|
|
|
I know that the math involved may be a bit tricky. Counting to one is hard sometimes.
Check your parantheses. You are trying to call the constructor of SolidBrush with five parameters, and to call the FillRectangle method with only a brush.
---
b { font-weight: normal; }
|
|
|
|
|
Hi, I just uploaded my query form on my ftp and an error is occuring. This is the error.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I don't know what to do. Please give me some answers if you know what can I do or what is this all about please? I have the web.cofig good and I made the
customErrors mode="Off"/
as suppose. What can I do now to eliminate this type of error please? Thanks for any feedback!!
Regards,
Adrian
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
You need to have the Virtual Directory as an Application. To accomplish this, Just open IIS and goto the properties for the Virtual directory and click
the Create Button.
|
|
|
|
|
hi, i made this as a virtual directory but i uploaded again the website and nothing happens. this is the website for you to see.
www.ivanandsimone.com/buyproductsquery/query.aspx
Thanks very much for any help.
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Ok, I need some help from the CP community. My place of work has some old school developers who are very proficient at building websites with classic ASP and VB COM+.
Different departments at work have been working with ASP.NET and C# for a while now, however, some of those old school developers are still of the opinion that:
- ASP.NET (controls, user controls, etc.) are bloated
- under the hood, ASP.NET is merely concatenating HTML strings to write to the browser anyway
- implementing our own engine that "writes" simple HTML to the browser is bound to perform better than the ASP.NET controls (less bloat, etc.)
- using C# to write HTML strings to the browser is a good step upward, because it gets us away from vbscript and COM DLL hell
I would like to build an argument for the contrary, but I am certainly willing to hear comments from both sides of the fence.
A few arguments that I can think of off the top of my head might be:
- ASP.NET is fine for so many other enterprise level sites, why are we special?
- how maintainable would the codebase be if we are writing out HTML strings?
- user controls are not perfect for use everywhere, but they definitely do have some advantages (code maintainability)
- how long would it take to get a newly hired ASP.NET developer "up to speed" with our methods if we implement our own thing?
- if the only real thing you are going to change about the development infrastructure is the language to C#, then is there really any point?
I'm looking for thoughts and opinions. I don't want to be a MS evangelist, but given the options we are comparing, it seems clear to me that true, typical ASP.NET development is the way to go, but I'd appreciate hearing some additional arguments.
Thanks.
[EDIT]
I would like to clarify that while the methods they plan to use are not adopting typical ASP.NET, they are also not proposing the other extreme of a C# page full of Response.Write commands. They would make use of some proper classes/objects to support the creation of HTML strings in a more structured way than true vbscript. In the end, it would probably wind up being a hybrid of decent C# OOP and vbscript style "string writing".
-- modified at 17:04 Tuesday 5th December, 2006
|
|
|
|
|
The people arguing with you are clueless. ASP.Net makes life easier for them. It is 10X easier to use then classic ASP. ASP.Net 2.0 performs much better then classic ASP so WTF are they talking about? The only issue I could see is that perhaps ASP.Net produces slightly more HTML which could affect dial up users. But who the hell uses dial up anymore? Not too mention Master pages, Themes, the Object Data Source control in 2.0. While I agree 1.1 was just OK, 2.0 is simply amazing. They're smokin crack if they'd rather write classic asp and vb script. In a few years they won't have any marketable skills? Do they want to be Dinosaurs stuck working with old technology? I don't get that one bit.
Seriously, go to msdn and research the objectDataSource control and master pages. They make life so much easier.
|
|
|
|
|
yeah, in the end you're just writing HTML strings , or talking to some SQL thing somewhere, or drawing reports (just like every other app in the universe) but what's wrong with wanting to make that job as painless as possible ? IMO, anyone who thinks classic ASP is better in any way than ASP.Net simply hasn't done anything big in ASP.Net. and C# is such a superior language to VBScript, it's like night and day.
bloat, "just writing strings", "perform better" - all sounds like things people would say when they're trying to avoid learning something new...IMO
|
|
|
|
|
I am 54 but I am not Old School. I made the transition when 1.0 came out. This transition was easy since I used to use InterDev and VB Web Classes.
I found writing ASP code easy but a maintenance nightmare, especially when the program is adopted by other sites. ASP.NET is much easilier to maintain and deploy. ASP has pseudo OOP. ASP.NET embraces OOP and GOF design patterns. Also, you can create Web Services and Window Services in .NET to facilitate access to modern and legacy resouces.
I wrote a SPC ASP.NET Application that included some real-time data collection using C++/CLI and C#. So, what you can do with ASP.NET and .NET goes beyond creating reports and data entry programs.
|
|
|
|
|
Thanks alot for sharing, it's appreciated.
|
|
|
|
|
i have:
1. a Master Page
2. a content page (which uses the Master page)
3. a User Control (which resides on the Master page). it has a button.
i want to send an event to the content page when the button on the User Control is clicked.
what does it take to make that happen ?
i've tried adding code to the master page to add an event handler to an event on the User Control, but that gives me compilation errors because the other pages that use the master page don't know about the User Control code (so the delegate / event type that i define to interact with the User Control shows up as undefined in the content pages). i've tried a million other things that just don't work for similar reasons... there must be a way to do this...
ideas ?
|
|
|
|
|