r/ASPNET • u/48klocs • Jun 30 '08
r/ASPNET • u/[deleted] • Nov 21 '13
A question about "javascript:WebForm_DoPostBackWithOptions()"
Edit: Ok! Got the answer. I was missing some hidden fields that javascript functions set up in the background. Fiddler did the trick and showed me exactly what needed to be entered.
I'm not sure if this is the right place to go. I'm not a web dev, but the posts I've seen online lead me to believe this fits under the realm of aspnet. I couldn't find a good reference that explained the WebForm_DoPostBackWithOptions() function/object/whatever it is.
Basically, I'd like to understand what this is doing:
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$SaveButton", "", true, "", "", false, false))"It's part of the following button tag:
<input type="submit" name="ctl00$ContentPlaceHolder1$SaveButton" value="Save" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$SaveButton", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder1_SaveButton" class="butt" />Now for what I'm trying to do!
My company uses a SaaS application built on aspnet accessed by internet explorer. They have no API to automate things like new user creation and the like. I've already dealt with a few other websites like this and I've successfully automated these tasks via the Invoke-WebRequest cmdlette.
I get the website and fill out the proper fields as follows:
#For those who don't work in powershell, these are comments! :D
#Also, variables start with dollar signs.
#Assume $url holds the proper url, and I've authenticated properly with the proper session variable.
$addUserSite = Invoke-WebRequest $url -WebSession $session #get the website $url using the session contained in $session
$addUserForm = addUserSite.Forms[0] #Invoke-WebRequest does a lot of auto processing. So I can pull out the proper form like so.
$addUserForm.Fields["ctl00_ContentPlaceHolder1_username"] = "username" #The field listed above will have the value "username" assigned to it. I'd be interested in understanding why the ctl00_ is everywhere too . . .
$addUserForm.Fields["ctl00_ContentPlaceHolder1_password"] = "My super secure pa$$w0rd!!!!"
$addUserForm.Fields["ctl00_contentPlaceHolder1_Verify"] = "My super secure pa$$w0rd!!!!" #Assume that's it for the form!
#Please note, I can see the associated action by viewing
#the output of $addUserForm.Action. I've verified that the
#associated website assigned to the form is the same as
#$website.
$result = Invoke-WebRequest -uri $website -method post -Body $addUserForm.Fields -WebSession $session #This means that I want to send the fields in $addUserForm.Fields to $website as post data under the proper session.Now, $result acts like I've submitted nothing! Every field is blank with the generic "please fill out required fields" error all over the place.
Now, the button I have to press is the one I referenced above. Which leads me to believe that my issue lies in my lack of understanding this:
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$SaveButton", "", true, "", "", false, false))"So far, I've been able to deduce that the click is supposed to invoke the javascript function WebForm_DoPostBackWithOptions(). And my research so far leads me to believe that this method generally tells the webpage to reference another site. But I haven't been able to find enough documentation to determine what every field in the object constructor (I think that's what new WebForm_DoPostBackWithoutOptions() is at least) does. And none of them look like a website that can be referenced.
So, wise folk of /r/aspnet! Can you offer any insight? I'd rather not have to resort to dealing with an InternetExplorer comobject.
r/ASPNET • u/teddylike • Nov 03 '13
XLS to PDF for free?
I have a project where I need to convert Excel (.xls) files to a more user friendly format - preferably .pdf - for downloading and viewing.
I haven't found any free third party tools to do this, any of you had any luck?
Thanks!
r/ASPNET • u/[deleted] • Oct 30 '13
Need Suggestion on ASP.net share hosting
So far from my research arvixe seem to be a good shared hosting with unlimited ms sql option. Is it really unlimited for the ms sql? How about the db size?
but I found this review and their server seem to be down quite often.
Anyone got any experience with them or can you suggest a reasonable price asp.net hosting that allow you to host wcf and either unlimited ms sql or at least unlimited mysql db.
r/ASPNET • u/MisterCrispy • Sep 04 '13
Use the MVC Web Application Template in empty/basic project?
Is there a way to install/add the design/look and feel in a project that isn't the "MVC Web Application Template"? I want to use it in a quick project I'm writing but I don't want to go through all the junk (user authentication, default views and such) that get installed along with it. I just want the style sheets, layout and graphics.
Is there any way to do that?
r/ASPNET • u/MisterCrispy • Jul 07 '13
MVC 4: Entity framework "edit/create" view but don't use the DB field names?
Ok, I'm a long time Webforms developer but I've been having a hard time wrapping my head around MVC. It seems like all my questions are so simple that NO ONE writing a tutorial or book feels that they should address them. I've written one web app in MVC so far but, for the sake of time, I think I cheated a bit. I used the controllers as a RESTful web service and did all the functionality through JQuery. I have to say, MVC makes web services SO much easier.
For this, I wanted to actually convert an older piece of software I wrote over and do it the "right" way which is to say "the way all the books and stuff say I should do it". (Side note: the information on database first designs are few, far between and terrible.)
So I've got entity framework connecting to an existing database and it will do the add/delete/update and so on and so forth. My question is, however, is it possible to have it show more friendly names as opposed to the database field names it uses now?
<div class="editor-field">
@Html.EditorFor(model => model.Em_policy_nb)
@Html.ValidationMessageFor(model => model.Em_policy_nb)
</div>Would I just replace the "EditorFor" with plain html or is there a way to do it via the razor stuff?
Also, does anyone know of a book along the lines of "MVC for stubborn Webforms developers: how to deprogram your brain"?
UPDATE: Thanks everyone! The buddy classes thing wound up doing exactly what I needed.
r/ASPNET • u/mitzman • Jul 04 '13
custom membershipprovider, multiple connection strings and an issue...
So I rolled out my own membership provider (it inherits membershipprovider). It authenticates against Active Directory and does some other things in the backend to store user info, etc. The problem is our forest has 16 domains (and growing). I have setup my web.config with connection strings to each domain and then (unfortnuately) I have an entry for each domain under <memberships>. I would love to have only one provider and just choose which connection string I need.
So what I've done to try and attempt this is in the initialize sub of the membership provider, I set the connection string based on the value of a custom class I write...
membershipclass.connectionstring="LDAP://whatever.blah.com"In the initialize sub I set the connectionstring of the membership to membershipclass.connectionstring. This works fine but the problem is initialize is only called once during testing. I would have to stop IIS and restart it in order for initialize to run again. I'm creating an instance of my membership provider like this
usersdomain="userdomain.whatever.com"
dim domainprovider as new admembershipprovider(usersdomain)As I mentioned above that works great for the first time the app runs but in subsequent attempts, it doesn't initialize. Has anyone had any luck with this in the past and maybe can provide some assistance? I realize I summarized what I'm looking for but can definitely give any more info if you need it.
r/ASPNET • u/[deleted] • Jun 08 '13
help with linking a button to a database?
I'm creating a web application that has a database of student information (such as data on standardized reading and math tests and reading level etc).
How do I link the database to a button such that when the button is clicked, it can draw upon the information stored in the database to manipulate other variables.
The end result is that I want to be able to group students based on different test results. So when the button is clicked it calls on certain test scores, which are used to manipulate a seating variable.
I'm coding in visual basic if that makes a difference.
r/ASPNET • u/Winvoker • May 06 '13
AjaxControlToolkit not working. Need some suggestions
The modalpopups for ajaxcontroltoolkit were working at one point, but they've stopped working properly for an unknown reason. Instead of appearing when the user clicks on an eventTrigger, they're always at the bottom of the screen. Packages have been reinstalled and there's no build errors. Any suggestions?
r/ASPNET • u/Ishnatal • Apr 26 '13
MVC 4: Web.config connectionString for Firebird Database?
I've been trying to get a connectionString that works for connecting my ASP MVC 4 (.NET 4) application to a remote Firebird Database. My Google-fu is failing me!
I'm very new to ASP.NET in general, so a lot of this is diving in with my eyes closed and feeling around for some sort of solution. Is there some sort of tutorial I missed? Something I need to include somewhere? And where would I include it?
r/ASPNET • u/marcoita • Mar 18 '13
How to update multiple formviews with one button.
how to Update multiple formviews each with their own accessdatasource with one update button.
Thanks In advance
r/ASPNET • u/KeyboardBasher1 • Mar 16 '13
Voting / Repeater / JQuery Question
Hello all,
I am using a repeater to iterate over stories from a database and I dynamically create a basic upvote/downvote button with some text. I want to make it so someone can only vote once based on their IP Address.
For each story to vote on, I was going to (in the repeater) dynamically add a hyperlink to my .net literal and assign a javascript onclick function to it.
In the onclick function, I would make an ajax call to a page called Vote.aspx (passing over the ip address of the user and the story they are voting on). This page will then update the item on the backend, and then return a success code (or failure if the user with that IP already voted).
After the request comes back, I will update in real time the vote to be vote +1.
Obviously if someone just goes to Vote.aspx, and passes in random ip addresses, they can vote unlimited times for that story.
I was thinking of just passing in a token as well (maybe the MD5 of the ip address, the current year or day or something) and then on the server side just verify the token with the ip address parameter put in and the current year. Then if there is a match, great, if not, then no.
..Is this okay? It's just voting, nothing super crazy, but I did want to discourage people who could figure out to go to vote.aspx and just vote excessively on a story.
Thanks so much :)
r/ASPNET • u/koobazaur • Feb 18 '13
Application_ResolveRequestCache() taking 10 seconds on first call after Application first starts?
I am using RackSpace hosting for my ASPX WebApp and I noticed that, if the site is not accessed in a while, the first pageload can take upwards of 10-15 seconds. After that, subsequent requests load really fast, until there is again a longer pause between them.
I put timestamp logging in all the Global.asax function and here's what it reveals (in miliseconds): Applicaton_BeginRequest[0], Application_AuthenticateRequest[16], Application_ResolveRequestCache[16], Session_Start[11216], Application_AcquireRequestState[11216] ...
So it seems between ResolveRequestCache and Session_Start it takes about 11 seconds! Like I said, this only happens when the website has not been viewed for a while. What's going on? Is my application building the initial cache on first request after it starts? Is 11 seconds normal or is my code that horrible? Is it an issue on my end or my webhost?
FYI: Log confirms Application_End() gets called after x seconds of inactivity and then Application_Start(), followed by the lengthy first pageload, then normal fast pageloads
r/ASPNET • u/AESensei • Sep 16 '12
What has your experience with NancyFX been? Have you used it in Self Hosted mode?
Looking for your experience, feedback, tales of heroics, or tales of horror.
r/ASPNET • u/OrpheusV • Sep 15 '12
Slightly stuck with checkboxes.
Long story short, here's the issue. For a sample problem, I need to get it so that for each checkbox selected, it's an additional $50 fee added to a total. I'm trying to just use a variable that is added to a subtotal variable, but I can't seem to get VB to think that more than one check box means more than one instance of $50 being added on.
Help? Sample idea I had but doesn't seem to recognize more than one checked box:
If CheckBoxList.SelectedIndex = 0 Then fee1 = 50 End If
Repeat this twice, changing fee1 to fee2, and SelectedIndex to 1, and then to 2, respectively. feeTotal = fee1 + fee2 + fee3
I have zero clue why it's not doing what I want it to do.
r/ASPNET • u/AESensei • Sep 09 '12
How to Create Server Side Paging for DataTables.Net using Expression Trees. Great tool that just works with your DTO's.
r/ASPNET • u/davik2001 • Aug 24 '12
Simple problem - Application level tracing but what the hell am I doing wrong?
This is driving me crazy.
I decided to turn on application level tracing just so I don't have to keep specifying trace=true at the top of all my asp.net pages to debug them.
When I do this, none of my events fire off, button clicks, page loadbacks, nothing. It just clears the page as if it were a fresh load, the trace is running, all the debug info is listed there, the method listed goes from GET to POST but no evidence that that a certain event fired off.
BUT
If I create a new page, drop a button in there and add some code to it, the event fires off on a new page new problem, but none of my old pages.
Any ideas? Thanks for any help.
r/ASPNET • u/RMooney • Mar 06 '12
Login Sessions and Carrying USerID Forward
Building a group web site for our capstone project and we're having trouble logging in and carrying the UserID forward from login to other pages where we have an admin and member view so they can edit their profile. Problem is when we try to fill the member or admin form for editing/updating there is NO UserID there and for the life of me I cannot figure out how to do this?
We are using Sql Server 2008 as our database server. We can connect fine, add the new member application to the database fine, it's just that the loginID is not carried forward to the update profile screens.
We are using a datareader to read the table from the Database to fill the newmemeber form, but we really don't want to have to do that for the edit/update member and admin profiles.
I would appreciate it if someone could give me an example of how to carry the login ID forward using session variables so that we can fill the member or admin form based on their security level in the databse then update it as needed. We have the correct code in our member class it's just the ASP and C# code that is giving us fits.
Thanks in advance to anyone who attempts to tackle this for us.
r/ASPNET • u/[deleted] • Sep 15 '11
Just stumbled across Piczard and may use it for an upcoming project involving image manipulation. Anyone have any experience/thoughts with it?
r/ASPNET • u/arfilion89 • Feb 17 '11
using ssl and https
I have spent the last 2 hrs searching how to connect to my own website using https, while in visual studio 2008
Anybody know what i must do?
r/ASPNET • u/ours • Aug 05 '10
Are there any alternatives to Dynamic Data?
Dynamic Data sounds like a cool scaffolding system but I have heard so little about it since it was released plus the official Dynamic Data team page has barely been updated since the final release (it still points to "Get .Net 3.5 SP1"!) that I have trouble investing time in such a product.
Are there any alternatives to it? If there aren't or they aren't worth the effort, should I roll my own?
I prefer custom development with ASP.Net MVC but I'm being pressured into providing a tool for RAD.